Page 1 of 1

Help with convert v6.7.7 versus v6.8.9 on gray:- image

Posted: 2016-05-20T11:20:12-07:00
by ams57
I'm trying to understand the following difference between convert versions 6.7.7 (Ubuntu 14.04) and 6.8.9 (Ubuntu 16.04) operating on a raw thermal image extract from a FLIR camera JPG.

Unix "file" reports the input image is "PNG image data, 120 x 160, 16-bit grayscale, non-interlaced"
Version 6.7.7 ":info" reports "PNG 120x160 120x160+0+0 16-bit PseudoClass 65536c 18.8KB 0.000u 0:00.000"
Version 6.8.9 ":info" reports "PNG 120x160 120x160+0+0 16-bit Grayscale Gray 18.8KB 0.000u 0:00.000"

The following command line expression produces the correct output.png under 6.7.7
convert input.png gray:- | convert -depth 16 -endian msb -size 120x160 gray:- output.png
but produces what looks to be just random noise under 6.8.9

Note that I am not sure I entirely understand why the original code makes use of the explicit gray:- conversion; I do know that the command line expression
convert -depth 16 -endian msb -size 120x160 input.png output.png
produces identical image outputs (beyond slight differences in the PNG header) in both versions, but the output produced is not the same as the output
image I would expect to see (which is the output.png produced by the pipe expression shown above with the explicut gray:- conversions but only with
convert verstion 6.7.7).

Any help is greatly appreciated.

Re: Help with convert v6.7.7 versus v6.8.9 on gray:- image

Posted: 2016-05-20T11:25:38-07:00
by fmw42
IM 6.7.7 was at a time that IM was undergoing some significant changes in colorspace and grayscale. It may have been at a time that grayscale was linear. Prior to the change and subsequent to the change IM grayscale was non-linear. See viewtopic.php?f=4&t=21269. I do not know if this is your issue or not.

Re: Help with convert v6.7.7 versus v6.8.9 on gray:- image

Posted: 2016-05-20T11:47:52-07:00
by snibgo
I don't understand what you want to do. Your commands take an input PNG file and make an output PNG file. The processing should have no effect, but might under 6.7.7 which was confused by grayscale images.

Why is "-endian msb" in there? This might be making the "random noise" you see.

Re: Help with convert v6.7.7 versus v6.8.9 on gray:- image

Posted: 2016-05-20T11:52:51-07:00
by ams57
Thanks fmw42; explicitly adding "-set colorspace sRGB" seems to do the trick.

snibgo: while this isn't originally my code, it's intended to run across many platforms, hence, I suspect, the explicit "-endian".