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

Questions and postings pertaining to the usage of ImageMagick regardless of the interface. This includes the command-line utilities, as well as the C and C++ APIs. Usage questions are like "How do I use ImageMagick to create drop shadows?".
Post Reply
ams57
Posts: 2
Joined: 2016-05-20T10:57:33-07:00
Authentication code: 1151

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

Post 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.
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

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

Post 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.
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

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

Post 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.
snibgo's IM pages: im.snibgo.com
ams57
Posts: 2
Joined: 2016-05-20T10:57:33-07:00
Authentication code: 1151

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

Post 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".
Post Reply