Page 1 of 1

Possible bug with bilevel TIFF in IM 6.9.2.8 Q16 Mac OSX

Posted: 2015-12-13T13:47:07-07:00
by fmw42
.
See viewtopic.php?f=1&t=28809&p=128236#p128233 for input images.

The following fails using 2.tif as input because it is bilevel and forces the output to be bilevel including where the color overlay image, label1.gif, is placed. I have tried adding -set colorspace sRGB, -colorspace sRGB and -type truecolor right after the input images. (The latter makes the resulting image totally black)

Code: Select all

convert 2.tif label1.gif -gravity northwest -geometry +3+3 \
-define compose:args=80,100 -compose dissolve -composite 2_label1a.tif
http://www.fmwconcepts.com/misc_tests/t ... abel1a.tif


But it works fine if one converts the 2.tif to PNG

Code: Select all

convert 2.tif 2.png
convert 2.png label1.gif -gravity northwest -geometry +3+3 \
-define compose:args=80,100 -compose dissolve -composite 2_label1b.tif
http://www.fmwconcepts.com/misc_tests/t ... abel1b.tif

Note that

Code: Select all

convert 2.tif -type truecolor -auto-level 2b.tif
results in a totally black image.

Re: Possible bug with bilevel TIFF in IM 6.9.2.8 Q16 Mac OSX

Posted: 2015-12-13T15:17:40-07:00
by magick
Add -depth 8 -compress zip to your command line. The TIFF image has a depth of 1 and a compression of Group4Compression. That is carried forward to the output image. The depth and compress options override these settings to produce the image you expect.
  • convert 2.tif label1.gif -gravity northwest -geometry +3+3 -define compose:args=80,100 -compose dissolve \
    -composite -depth 8 -compress zip 2_label1b.tif

Re: Possible bug with bilevel TIFF in IM 6.9.2.8 Q16 Mac OSX

Posted: 2015-12-13T15:29:47-07:00
by fmw42
Thanks that works.

I forgot about depth and compression when trying to override the bilevel input format.

Re: [RESOLVED] Possible bug with bilevel TIFF in IM 6.9.2.8 Q16 Mac OSX

Posted: 2015-12-24T03:12:32-07:00
by mr_hunter
Hi there - This solution doesn't work for multi-page TIFFs as it just layers all the pages on top of each other and seems to not add the label. Any ideas? I've tried adding +adjoin but didn't make any difference.. :(

Re: [RESOLVED] Possible bug with bilevel TIFF in IM 6.9.2.8 Q16 Mac OSX

Posted: 2015-12-24T03:47:11-07:00
by mr_hunter
I've tried with PDFs and it does the same sadly as I have a need to stamp PDFs with the label also.

If I don't hear from you before have an excellent Christmas (if you celebrate it).. :-)

Re: Possible bug with bilevel TIFF in IM 6.9.2.8 Q16 Mac OSX

Posted: 2015-12-24T09:55:42-07:00
by fmw42
Can you provide an example multi-layer tiff for us to test?

Re: Possible bug with bilevel TIFF in IM 6.9.2.8 Q16 Mac OSX

Posted: 2016-01-05T07:24:17-07:00
by mr_hunter
Hi there - sorry for delay. Wasn't on laptop over Christmas.

Here is the code and the associated files below...

convert 2.tif stampOnDoc.gif -gravity northwest -geometry +3+3 -define compose:args=80,100 -compose dissolve ^
-composite +adjoin -depth 8 -compress zip tmp2.tif

2.tif https://www.dropbox.com/s/b8y7shdrutcvag5/2.tif?dl=0
stampOnDoc.gif https://www.dropbox.com/s/hssmnifq2fiea ... c.gif?dl=0
tmp2.tif https://www.dropbox.com/s/jb33ac9h705zufc/tmp2.tif?dl=0

Thanks :)

Re: Possible bug with bilevel TIFF in IM 6.9.2.8 Q16 Mac OSX

Posted: 2016-01-10T13:24:51-07:00
by fmw42
-composite only works with two images. Your tiff has several layers which are considered by IM as separate input images. So you need to use -layers composite as follows setting the alpha channel of the overlay (gif) image to 80% or whatever you want.

Code: Select all

convert 2.tif -coalesce \
null: \
\( stampOnDoc.gif -alpha on -channel alpha -evaluate set 80% +channel \) \
-channel rgba -gravity northwest -geometry +3+3 \
-layers composite -depth 8 -compress zip result.tif
or

Code: Select all

convert 2.tif -coalesce \
null: \
\( stampOnDoc.gif -alpha on -channel alpha -evaluate set 80% +channel \) \
-channel rgba -gravity northwest -geometry +3+3 \
-layers composite -depth 8 -compress zip +adjoin result.tif