rmagick icon indicating copy to clipboard operation
rmagick copied to clipboard

Flesh out specs for class_type and class_type=

Open Le1gh opened this issue 5 years ago • 4 comments

Le1gh avatar Nov 16 '20 17:11 Le1gh

@dlemstra we're trying to understand what happens when changing the image class_type. On ImageMagick 7, it actually seems to compress the image some, but on ImageMagick 6 it does not? Does that sound right? Can you explain the difference?

mockdeep avatar Nov 23 '20 04:11 mockdeep

I could check this for you but it could be possible that when we notice that the image only has a fully opaque alpha channel we remove that channel and then reduce the channels from 4 (RGBA) to 3 (RGB) when changing between class_type.

dlemstra avatar Nov 23 '20 09:11 dlemstra

@dlemstra thanks for the response. Would that result in the pixel color values changing? For some reason when we get the actual pixel colors they have changed. Anecdotally, it seemed to be reducing the number of colors. Correction to my previous statement, this behavior seems to have changed from IM 6.8 to 6.9.

mockdeep avatar Nov 23 '20 17:11 mockdeep

It turns out that Image_class_type_eq is calling QuantizeImage and that will dither the image by default. What happens when qinfo.dither_method = NoDitherMethod is added? This is the settings that are being used in my Magick.Native library:

number_colors = MaxColormapSize;
tree_depth = 8; // MaxTreeDepth;
dither_method = NoDitherMethod;

dlemstra avatar Nov 23 '20 23:11 dlemstra