Watermarking images with proportional watermark
Posted: 2018-10-15T23:57:38-07:00
Hey guys, this has been driving me crazy for the last two days, I've tried just about every example here and NOTHING seems to work, so I'm hoping I'm just doing something silly here.
I have images being uploaded to a site of unknown dimensions. I have a pre-built watermark and I simply want to overlay it on the image at some arbitrary size (ie: bottom left corner at 10% height of the image). Typical watermark stuff.
What is happening is that the examples I've tried that *should* be auto-magically resizing the watermark relative to the image simply aren't doing that and are instead leaving the watermark the same size, so I get the uploaded image with the watermark the original size, and not scaling relative to the image at all. The same thing happens if I start with a larger watermark image - it stays it's original size on the image it's being overlaid on without scaling.
An example output image is here:
https://searcharchives.missionarchives. ... /05Tbp.jpg
This is the larger watermark image (https://searcharchives.missionarchives. ... rmark2.png).
The commands I've tried which all result in the image there (with the big watermark) are:
This example was originally '.h/5' to make the watermark file 1/5th the height of the image, but .h/5 and .h/2 gave exactly the same result
These examples have all been pulled from the forums here, and all of them claim to work and do what I'm looking for, but it's almost like the '-resize' part of the command is simply ignored and the images are simply composited together.
Anyone able to help here?
Version: ImageMagick 6.8.9-9 Q16 x86_64 2017-07-31 - Linux
I have images being uploaded to a site of unknown dimensions. I have a pre-built watermark and I simply want to overlay it on the image at some arbitrary size (ie: bottom left corner at 10% height of the image). Typical watermark stuff.
What is happening is that the examples I've tried that *should* be auto-magically resizing the watermark relative to the image simply aren't doing that and are instead leaving the watermark the same size, so I get the uploaded image with the watermark the original size, and not scaling relative to the image at all. The same thing happens if I start with a larger watermark image - it stays it's original size on the image it's being overlaid on without scaling.
An example output image is here:
https://searcharchives.missionarchives. ... /05Tbp.jpg
This is the larger watermark image (https://searcharchives.missionarchives. ... rmark2.png).
The commands I've tried which all result in the image there (with the big watermark) are:
Code: Select all
convert $FILE1 $WATERMARK -resize %[fx:u[0].w]x -gravity south -composite $FILE1
Code: Select all
convert $FILE1 \( $WATERMARK -resize x%[fx:u[0].h/2] \) -gravity south -composite $FILE1
Code: Select all
convert $FILE1 $WATERMARK -resize "x%[fx:t?u[0].h/100:u[0].h]" -gravity south -composite $FILE1
Anyone able to help here?
Version: ImageMagick 6.8.9-9 Q16 x86_64 2017-07-31 - Linux