<commit_before>## ImThumb

> A [TimThumb](http://www.binarymoon.co.uk/projects/timthumb/) compatible image generation script, based on ImageMagick instead of GD.

### About

I originally wrote this because I was attempting to optimise the quality of TimThumb generated images, and realised that the lower quality images actually had larger filesizes than the higher quality ones. I ended up digging in a bit and came to the conclusion that some of GD's internals, as well as the way TimThumb uses it, were responsible. Rather than attempt to patch a very old and neglected library and fight against GD, I decided to reimplement the same functionality on top of ImageMagick.

* Drop-in replacement, uses the same configuration files as TimThumb does.
* Self-contained class files and structured image handling API for direct integration with other applications and scripts.

#### Additional Functionality

The following additional features are provided by ImThumb in addition to baseline TimThumb functionality:

* Direct cropping using explicit coordinates. The querystring parameter `cr` accepts four comma-delimited numbers indicating pixel positions to crop to: `startX`, `startY`, `endX` and `endY`. If any numbers are negative or outside the bounds of the image then the image will be positioned within a larger canvas containing itself. When combined with the normal `w`idth and `h`eight parameters, the resulting cropped image is reprocessed to fit within the target dimensions as it would normally be when passed to ImThumb pre-cropped.
* Extended image filters from the ImageMagick library. For a full list, see [this manpage](http://www.php.net/manual/en/class.imagick.php#imagick.imagick.methods) under the heading "*Image effects*".<commit_msg>version history<commit_after>## ImThumb

> A [TimThumb](http://www.binarymoon.co.uk/projects/timthumb/) compatible image generation script, based on ImageMagick instead of GD.

### About

I originally wrote this because I was attempting to optimise the quality of TimThumb generated images, and realised that the lower quality images actually had larger filesizes than the higher quality ones. I ended up digging in a bit and came to the conclusion that some of GD's internals, as well as the way TimThumb uses it, were responsible. Rather than attempt to patch a very old and neglected library and fight against GD, I decided to reimplement the same functionality on top of ImageMagick.

* Drop-in replacement, uses the same configuration files as TimThumb does.
* Self-contained class files and structured image handling API for direct integration with other applications and scripts.

> #### Version history
>
> `1.0` - baseline functionality. Handles a complete set of TimThumb parameters and operations when running on local files, with some neat additions. In production use.
> `2.x` (current) - massive refactoring, more modular class structure. The new image reading API allows drawing in remote images via HTTP or indeed any concievable data source. **Alpha** and in progress.

#### Additional Functionality

The following additional features are provided by ImThumb in addition to baseline TimThumb functionality:

* Direct cropping using explicit coordinates. The querystring parameter `cr` accepts four comma-delimited numbers indicating pixel positions to crop to: `startX`, `startY`, `endX` and `endY`. If any numbers are negative or outside the bounds of the image then the image will be positioned within a larger canvas containing itself. When combined with the normal `w`idth and `h`eight parameters, the resulting cropped image is reprocessed to fit within the target dimensions as it would normally be when passed to ImThumb pre-cropped.
* Extended image filters from the ImageMagick library. For a full list, see [this manpage](http://www.php.net/manual/en/class.imagick.php#imagick.imagick.methods) under the heading "*Image effects*".
{'fraction_non_alphanumeric': 0.05571173013033478, 'fraction_numerical': 0.0007666751852798365, 'mean_word_length': 5.0030674846625764, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 9, 'https://': 0, 'lorem ipsum': 0, 'www.': 4, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2779799', 'n_tokens_mistral': 927, 'n_tokens_neox': 909, 'n_words': 536}