Repository navigation
[imagick] Document Imagick::quantizeImage() and Imagick::quantizeImages() - #61
Merged
jordikroon merged 1 commit intoNov 28, 2026
Merged
Conversation
…es() The pages described these methods as "analyzing the colors" of an image, which is misleading since nothing is returned: the methods reduce the number of colors of the image(s). All parameter descriptions were also empty. Based on the MagickQuantizeImage()/QuantizeImage() implementation in ImageMagick: - fix the purpose of both methods, and add a description explaining that quantizeImages() chooses a single set of colors shared by all the images of the sequence, unlike quantizeImage(); - document numberColors (0 means the maximum colormap size), colorspace, treedepth (0 computes an optimal depth, other values are clamped to 2-8), dither and measureError; - add a caution that with ImageMagick 7 the dither flag is passed as a DitherMethod, so true maps to NoDitherMethod and false to UndefinedDitherMethod, which results in Floyd-Steinberg dithering, i.e. the meaning of the flag is inverted. Fixes php#30
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The
Imagick::quantizeImage()andImagick::quantizeImages()pages said these methods "analyze the colors" of an image. That's misleading, because nothing is returned: they reduce the number of colors in the image(s). All of the parameter descriptions were empty too.Based on the
MagickQuantizeImage()/QuantizeImage()implementation in ImageMagick, this change:quantizeImages()picks one set of colors shared by every image in the sequence, whilequantizeImage()only works on the current image;numberColors:0, or a value above the maximum colormap size, means the maximum colormap size;colorspace, with a link to the COLORSPACE constants;treedepth:0computes an optimal depth, and other values are clamped to 2–8;ditherandmeasureError;ditherwith ImageMagick 7. Imagick passes the boolean straight through as theDitherMethodargument, sotruebecomesNoDitherMethodandfalsebecomesUndefinedDitherMethod, which ImageMagick handles as Floyd-Steinberg dithering. In other words, the flag works the opposite way, as pointed out in the issue.Fixes #30