Watermarking a TIFF only happens on the thumbnail
Posted: 2019-08-28T12:11:41-07:00
I am using the below code to watermark images. I ran into a TIF file that the watermark image is placed on the thumbnail of the image. If i open the image in Photoshop i do not see the watermark. If i look at the image with Windows Viewer or Apple Preview app i see the watermark.
I do see these warnings:
convert: Incompatible type for "RichTIFFIPTC"; tag ignored. `TIFFFetchNormalTag' @ warning/tiff.c/TIFFWarnings/1007.
convert: Unknown field with tag 42033 (0xa431) encountered. `TIFFReadCustomDirectory' @ warning/tiff.c/TIFFWarnings/1007.
Images to test with:
https://www.dropbox.com/sh/qnxobplnd684 ... SVf2a?dl=0
CentOS
Version: ImageMagick 7.0.8-15 Q16 x86_64 2018-12-07 h
# get dimensions of incoming file and save as a variable
dim=`convert -quiet "$1"[0] -format "%wx%h" info: 2>/dev/null`
echo $dim
echo $1 #incoming file
echo $2 #outgoing file
/usr/local/bin/convert \( "$1"[0] -background white -flatten -depth 8 \) \
\( -clone 0 -fill "gray(20%)" -colorize 50 \) \
\( /home/cgray/scripts/watermark.png -alpha extract -auto-level \
-write mpr:tile +delete -size $dim tile:mpr:tile \) \
-alpha off -compose over -composite \
"$2"
I do see these warnings:
convert: Incompatible type for "RichTIFFIPTC"; tag ignored. `TIFFFetchNormalTag' @ warning/tiff.c/TIFFWarnings/1007.
convert: Unknown field with tag 42033 (0xa431) encountered. `TIFFReadCustomDirectory' @ warning/tiff.c/TIFFWarnings/1007.
Images to test with:
https://www.dropbox.com/sh/qnxobplnd684 ... SVf2a?dl=0
CentOS
Version: ImageMagick 7.0.8-15 Q16 x86_64 2018-12-07 h
# get dimensions of incoming file and save as a variable
dim=`convert -quiet "$1"[0] -format "%wx%h" info: 2>/dev/null`
echo $dim
echo $1 #incoming file
echo $2 #outgoing file
/usr/local/bin/convert \( "$1"[0] -background white -flatten -depth 8 \) \
\( -clone 0 -fill "gray(20%)" -colorize 50 \) \
\( /home/cgray/scripts/watermark.png -alpha extract -auto-level \
-write mpr:tile +delete -size $dim tile:mpr:tile \) \
-alpha off -compose over -composite \
"$2"