I have an imagepipeline like this:
gm convert normalize-bug-example.png -strip -colorspace GRAY -flatten -resize '300x300' -normalize converted.png
With the attached image (from https://36.media.tumblr.com/tumblr_lvcwrlHqwl1qj9ldoo1_500.png) this produces a white image. It I move the "-normalize" in front of the resize, it works as expected.
The image carries a profile that I suspect to be causing the erratic bahaviour.
The reason for using strip, grayscale and flatten and the normalization after the resize is that this is a generic pipeline for all kinds of images from various sources. I found that doing the normalization after the resize gives better results, only it doesn't work at all for this type of image.
The problem is not the image profile. The problem is that this image is very weird in that it is primarily drawn in the alpha channel rather than the color channels. The -normalize operator only works on color channels and so it severely distorts the apparent results. Use
to produce an image containing only the content of the opacity channel.
Either of these commands might be used to produce a more ordinary file, but without anything in the alpha channel. The first one requires knowing the size in advance:
I have not figured out everything going on with the sequence of commands, but I notice that removing -flatten has an effect on what -normalize does after the resize.
Last edit: Bob Friesenhahn 2015-09-24
Thanks, this was very helpful. Feel free to close.
Image is a weird image which is not compatible with normalize.