Process modules and palettes
Posted: 2014-09-11T12:01:56-07:00
(I think this is a bug, but maybe it's a development issue.)
I have written a number of "-process" modules. See my page http://im.snibgo.com/customim.htm .
Fred has discovered, and I confirm, that they don't work correctly when the input (and hence the output) is a palette image.
I have built these with IM 6.8.9-6 Q32 HDRI. I don't know what Fred has used.
For example, replacelast.c (at http://im.snibgo.com/customim.htm#replacelast.c ) is a trivial module that replaces the image with one of the same size, but green.
This result is correct:


This result is incorrect. Every pixel is nearly black, (43,47,30) out of 255:

The problem also occurs in other modules, where I use SetPixelRed() etc, with QuantumRange values. The common factor in the problem is a palette input file. A workaround is "-type truecolor" to prevent the output from being palette.
If I should be doing something else in my code to prevent the problem, I'm happy to do it. But I hope my code doesn't need to worry about whether the image is palette.
I have written a number of "-process" modules. See my page http://im.snibgo.com/customim.htm .
Fred has discovered, and I confirm, that they don't work correctly when the input (and hence the output) is a palette image.
I have built these with IM 6.8.9-6 Q32 HDRI. I don't know what Fred has used.
For example, replacelast.c (at http://im.snibgo.com/customim.htm#replacelast.c ) is a trivial module that replaces the image with one of the same size, but green.
Code: Select all
%IMDEV%convert rose: -process replacelast roseRL1.png

Code: Select all
%IMDEV%convert rose: roseRL.gif

Code: Select all
%IMDEV%convert roseRL.gif -process replacelast roseRL2.png

The problem also occurs in other modules, where I use SetPixelRed() etc, with QuantumRange values. The common factor in the problem is a palette input file. A workaround is "-type truecolor" to prevent the output from being palette.
If I should be doing something else in my code to prevent the problem, I'm happy to do it. But I hope my code doesn't need to worry about whether the image is palette.