ImageMagick 6 Liquid Rescale: Alpha Channel Gets Discarded
Posted: 2015-05-16T21:13:06-07:00
There is a bug in ImageMagick 6 where the liquid rescale function discards the opacity channel of an image. What seems to happen is that liblqr is being passed the image with the alpha channel, but ImageMagick forgets to take it back after the transformation, because of a typo.
Here's a patch:
http://pastebin.com/nH3xE2ty
I also changed the contorted "if(image->matte != MagickFalse)" to "if(image->matte == MagickTrue)". I guess I could simply write "if(image->matte)" but I'm not sure what the coding conventions are for ImageMagick.
Finally, I have no idea what happens in ImageMagick 7. It might be nice if someone with ImageMagick 7 could test the -liquid-rescale function on an image with transparency to see if it is retained.
There are also a few more issues with the liquid rescale function, and I plan opening new threads for them.
Here's a patch:
http://pastebin.com/nH3xE2ty
I also changed the contorted "if(image->matte != MagickFalse)" to "if(image->matte == MagickTrue)". I guess I could simply write "if(image->matte)" but I'm not sure what the coding conventions are for ImageMagick.
Finally, I have no idea what happens in ImageMagick 7. It might be nice if someone with ImageMagick 7 could test the -liquid-rescale function on an image with transparency to see if it is retained.
There are also a few more issues with the liquid rescale function, and I plan opening new threads for them.