Watermark on TIFF not working

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
jegelie
Posts: 4
Joined: 2016-11-17T11:17:46-07:00
Authentication code: 1151

Watermark on TIFF not working

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

Re: Watermark on TIFF not working

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

Re: Watermark on TIFF not working

Post 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
jegelie
Posts: 4
Joined: 2016-11-17T11:17:46-07:00
Authentication code: 1151

Re: Watermark on TIFF not working

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

Re: Watermark on TIFF not working

Post by snibgo »

Sorry, that's too large for me to download. I can only cope with 10 MB.
snibgo's IM pages: im.snibgo.com
jegelie
Posts: 4
Joined: 2016-11-17T11:17:46-07:00
Authentication code: 1151

Re: Watermark on TIFF not working

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

Re: Watermark on TIFF not working

Post by fmw42 »

to get the first page use

Code: Select all

image.tif[0]
jegelie
Posts: 4
Joined: 2016-11-17T11:17:46-07:00
Authentication code: 1151

Re: Watermark on TIFF not working

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

Re: Watermark on TIFF not working

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