Page 1 of 1

Watermark on TIFF not working

Posted: 2016-11-17T11:31:55-07:00
by jegelie
Hi,

Version: ImageMagick 6.9.6-2 Q16 x86_64 2016-11-16 on MacPorts MacOS X 10.12.1 Sierra
I have some photos exported from Nikon Capture NX-D to TIFF (RGB 8bit). Trying to watermark them, with either of following commands:

Code: Select all

composite -watermark 67 -geometry +75+75 -gravity southeast -density 300 -background none ./WatermarkBWave.svg ./B-Wave-2016_DSC_0012.tif ./B-Wave-2016_DSC_0012-w.jpg

Code: Select all

composite -compose atop -geometry +75+75 -gravity southeast -background none ./watermark.svg ./B-Wave-2016_DSC_0012.tif ./B-Wave-2016_DSC_0012-wm.jpg

Code: Select all

composite -compose atop -geometry +75+75 -gravity southeast -background none ./WatermarkBWave-01.png ./B-Wave-2016_DSC_0012.tif ./B-Wave-2016_DSC_0012-wm.jpg

Code: Select all

convert -compose atop ./B-Wave-2016_DSC_0012.tif -geometry +75+75 -gravity southeast -density 300 -background none ./WatermarkBWave.svg -composite ./B-Wave-2016_DSC_0012-w.jpg
None worked. When I convert the tiff to jpg first, then watermark it to jpg again, it works flawlessly. Observe that I use a svg OR png as a watermarking picture. both don't work on TIFF but do on jpg.

The conversion/composition reads some warnings on the TIFFs too but I think I can ignore that:

Code: Select all

convert: ASCII value for tag "DateTime" contains null byte in value; value incorrectly truncated during reading due to implementation limitations. `TIFFFetchNormalTag' @ warning/tiff.c/TIFFWarnings/896.
convert: Unknown field with tag 34864 (0x8830) encountered. `TIFFReadCustomDirectory' @ warning/tiff.c/TIFFWarnings/896.
convert: Incompatible type for "FileSource"; tag ignored. `TIFFFetchNormalTag' @ warning/tiff.c/TIFFWarnings/896.
convert: Incompatible type for "SceneType"; tag ignored. `TIFFFetchNormalTag' @ warning/tiff.c/TIFFWarnings/896.
convert: Wrong data type 3 for "GainControl"; tag ignored. `TIFFReadCustomDirectory' @ warning/tiff.c/TIFFWarnings/896.
convert: ASCII value for tag "DateTime" contains null byte in value; value incorrectly truncated during reading due to implementation limitations. `TIFFFetchNormalTag' @ warning/tiff.c/TIFFWarnings/896.
What gives? For me to keep my workflow as simple as possible, I want to process my NEFs and export to TIFF, then run an ImageMagick script on them to convert to jpg with a watermark. Nikon Capture NX-D is unable to export anything else but NEF, TIFF 16bit or TIFF 8bit.

Re: Watermark on TIFF not working

Posted: 2016-11-17T11:41:55-07:00
by snibgo
jegelie wrote:None worked.
For us to help you, we need to know what went wrong. If you upload files to somewhere like dropbox.com and paste URLs here, we can try your commands.

Re: Watermark on TIFF not working

Posted: 2016-11-17T12:15:24-07:00
by fmw42
You might check on your version of libtiff

Code: Select all

tiffinfo
Also what delegate are you using to read the SVG file. (MSVG/xml, RSVG, Inkscape) and what version

Code: Select all

convert -list format
and see what it says for SVG

Re: Watermark on TIFF not working

Posted: 2016-11-17T12:24:34-07:00
by jegelie
Link to dropboxfolder with the test files

tiffinfo:

Code: Select all

LIBTIFF, Version 4.0.6
Copyright (c) 1988-1996 Sam Leffler
Copyright (c) 1991-1996 Silicon Graphics, Inc.
SVG delegate:

Code: Select all

convert -list format | grep SVG
     MSVG  SVG       rw+   ImageMagick's own SVG internal renderer
      SVG  SVG       rw+   Scalable Vector Graphics (XML 2.9.4)
     SVGZ  SVG       rw+   Compressed Scalable Vector Graphics (XML 2.9.4)
SVG on a jpg works, so I don't think the problem lies there...

Re: Watermark on TIFF not working

Posted: 2016-11-17T12:33:05-07:00
by snibgo
Sorry, that's too large for me to download. I can only cope with 10 MB.

Re: Watermark on TIFF not working

Posted: 2016-11-17T12:35:39-07:00
by jegelie
I think I am on to something: I accidentally opened a TIFF in Apple Preview. It looks like it is a multipage TIFF, with a thumbnail as the second page. This clarifies a lot of strange behaviour that I encountered when trying to build the commands... I'll try to find a way to select the first page of the TIFF.

I'll export a smaller TIFF from Nikon Capture NX-D for you for testing.

Re: Watermark on TIFF not working

Posted: 2016-11-17T12:46:37-07:00
by fmw42
to get the first page use

Code: Select all

image.tif[0]

Re: Watermark on TIFF not working

Posted: 2016-11-17T12:47:53-07:00
by jegelie
YES! Selecting first page worked like a charm:

Code: Select all

composite -watermark 67 -geometry +75+75 -gravity southeast -density 300 -background none ./WatermarkBWave.svg -alpha remove ./B-Wave-2016_DSC_0012.tif[0] ./B-Wave-2016_DSC_0012-w.jpg

Re: Watermark on TIFF not working

Posted: 2016-11-17T12:50:44-07:00
by fmw42
I would recommend that you start using the convert syntax. It is more flexible and composite is rather old and limiting. With convert, read the two input images first, then the arguments, then the output image.