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.
ImageMagick 6 Liquid Rescale: Alpha Channel Gets Discarded
Re: ImageMagick 6 Liquid Rescale: Alpha Channel Gets Discarded
We have fixed the issue that you reported and this will be fixed in ImageMagick 6.9.1-3. We are also going to make some other changes. Not sure if they will be in for the next release but we will changing the data type that is used to 'talk' with liblqr depending on the build of ImageMagick (Q8/Q16/HDRI).
Re: ImageMagick 6 Liquid Rescale: Alpha Channel Gets Discarded
Thanks for fixing the bug and reviewing the function.
Another issue with the liquid rescale function in both IM 6 and 7 is that there is this block of code that is unneeded and makes the function act incorrectly when resizing to a size equal to or larger than 200%.
It`s the block of code that starts by "if ((columns >= (2*image->columns)) || (rows >= (2*image->rows)))" and claims to "Honor liquid resize size limitations". This is unneeded, at least in the recent versions of liblqr, since if asked to rescale a image to 200% or more, it would automatically do it in multiple steps. And even if there was such a limitation, the correct way to handle it would be for ImageMagick to apply the liquid-rescale multiple times, not how it currently does it.
Everything should continue working if the block is simply removed.
Another issue with the liquid rescale function in both IM 6 and 7 is that there is this block of code that is unneeded and makes the function act incorrectly when resizing to a size equal to or larger than 200%.
It`s the block of code that starts by "if ((columns >= (2*image->columns)) || (rows >= (2*image->rows)))" and claims to "Honor liquid resize size limitations". This is unneeded, at least in the recent versions of liblqr, since if asked to rescale a image to 200% or more, it would automatically do it in multiple steps. And even if there was such a limitation, the correct way to handle it would be for ImageMagick to apply the liquid-rescale multiple times, not how it currently does it.
Everything should continue working if the block is simply removed.