Appending two TIFs modifies hex values?

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
mtcarlso
Posts: 7
Joined: 2014-07-17T11:43:40-07:00
Authentication code: 6789

Appending two TIFs modifies hex values?

Post by mtcarlso »

Howdy -

I'm appending two (identical) TIFF files - https://drive.google.com/drive/folders/ ... sp=sharing - and the resulting image seems to have changed one of the hex values for a particular shade of pink from #ff67bd to #fe67bc

I'm using the CLI. Here are the two commands I have tried:
convert +append bmp_tests/0803_export_0.tif +append bmp_tests/0803_export_1.tif +append +compress tif_to_tif_plus.tif
convert +append bmp_tests/0803_export_0.tif +append bmp_tests/0803_export_1.tif +append -compress None tif_to_tif_plus.tif

Both results are the same. Am I using or misunderstanding the compression flag incorrectly?

Many thanks for your help!

Version: ImageMagick 6.9.6-5 Q16 x86_64 2016-11-15
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Appending two TIFs modifies hex values?

Post by fmw42 »

I do not know if this will help, but proper IM 6 syntax is to read the two images first, then the command +append. So

Code: Select all

convert 0803_export_0.tif 0803_export_1.tif +append -compress None result.tif
Both input images have 55 colors and so does the output. I cannot say if any have changed. How did you measure that.

I extracted the unique colors and did a compare and they are exactly the same.

Code: Select all

convert -quiet 0803_export_0.tif -unique-colors 1.png
convert -quiet 0803_export_1.tif -unique-colors 2.png
compare -metric rmse 1.png 2.png null:
0 (0)
Using IM 6.9.9.4 Q16 Mac OSX Sierra
mtcarlso
Posts: 7
Joined: 2014-07-17T11:43:40-07:00
Authentication code: 6789

Re: Appending two TIFs modifies hex values?

Post by mtcarlso »

I see what you mean re: the same colors from the console. I am seeing the same (and thank you for the syntax recommendation).

I have to pull these images into Gimp afterwards to reindex the colormap afterwards (long story), and that was where I was seeing the colors come in differently after append. Something changes enough that their interpretation shifts them just slightly (and to a value similar enough that the colors get indexed incorrectly after my fix).

Something about them is causing both Gimp and Photoshop to interpret the colors differently before and after append. Which, unless there is an obvious change in the before-and-after image profiles that I am not seeing, may be more of a Gimp/PS problem...

Any thoughts?
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Appending two TIFs modifies hex values?

Post by fmw42 »

Possibly GIMP/PS is assigning different profiles to each, though I have my doubts it would do that.

I suppose IM or GIMP/PS could be modifying the colors to reassign them differently though keeping the same unique colors. But that seems strange to me also.
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: Appending two TIFs modifies hex values?

Post by snibgo »

mtcarlso wrote:... changed one of the hex values for a particular shade of pink from #ff67bd
According to "identify -verbose 0803_export_0.tif", the image is 16 bits/channel. So no pixels have the value #ff67bd. 5470 pixels do have the value #FF006700BD00.
mtcarlso wrote:Something about them is causing both Gimp and Photoshop to interpret the colors differently before and after append.
Are Gimp are PS reading the images as 8-bit? That would explain the problem.
snibgo's IM pages: im.snibgo.com
Post Reply