ResizeImage: Odd behaviour with 6.9.7
Posted: 2017-03-05T02:34:47-07:00
Hi,
I'm inheriting a code base at work from a project where the original developers have long since left. Since the code base has been languishing for over 2 years, one of the first things I want to do is update the ecosystem to take care of security issues, bug fixes etc - without changing the way anything behaves. So, the usual.
The original code base uses ImageMagick 6.7.7 from Ubuntu Trusty LTS, I'm trying to update to 6.9.7 (running on ArchLinux). The application in question in written in Ruby, so ImageMagick is accessed through the RMagick gem.
Now to the issue at hand: In the code base, image hashes are being created by resizing the image in question to an 8x8 geometry and then taking the hex values of the resulting pixels intensities. The version update of ImageMagick changes the output, starting at the result of the resize operation.
The image depth and channel depth in the resized image in both versions is 16, however the image type of the resized image for 6.7.7 was PaletteType, while for 6.9.7 it's TrueColorType. The really odd thing however is looking at the resulting RGB values of the pixels of the resized images: in the 6.9.7 version I'm getting channel values that are larger than 2^16 and sometimes even negative, which is not at all what I expect.
I had a look at the relevant sections of RMagick code, but it seems that nothing relevant changed here in the past few years which could cause these changes, so I'm guessing the changes originate within the ImageMagick implementation.
Is this new behaviour expected? If so, can someone point me to the rough version of the relevant changes, so that I can try and recreate the old behaviour with the new version? Any help would be greatly appreciated
I'm inheriting a code base at work from a project where the original developers have long since left. Since the code base has been languishing for over 2 years, one of the first things I want to do is update the ecosystem to take care of security issues, bug fixes etc - without changing the way anything behaves. So, the usual.
The original code base uses ImageMagick 6.7.7 from Ubuntu Trusty LTS, I'm trying to update to 6.9.7 (running on ArchLinux). The application in question in written in Ruby, so ImageMagick is accessed through the RMagick gem.
Now to the issue at hand: In the code base, image hashes are being created by resizing the image in question to an 8x8 geometry and then taking the hex values of the resulting pixels intensities. The version update of ImageMagick changes the output, starting at the result of the resize operation.
The image depth and channel depth in the resized image in both versions is 16, however the image type of the resized image for 6.7.7 was PaletteType, while for 6.9.7 it's TrueColorType. The really odd thing however is looking at the resulting RGB values of the pixels of the resized images: in the 6.9.7 version I'm getting channel values that are larger than 2^16 and sometimes even negative, which is not at all what I expect.
I had a look at the relevant sections of RMagick code, but it seems that nothing relevant changed here in the past few years which could cause these changes, so I'm guessing the changes originate within the ImageMagick implementation.
Is this new behaviour expected? If so, can someone point me to the rough version of the relevant changes, so that I can try and recreate the old behaviour with the new version? Any help would be greatly appreciated