Page 1 of 1
Controlling opacity when overlaying an image
Posted: 2010-06-02T07:49:14-07:00
by hollymcr
I'm trying to do something that feels like it should be fairly straightforward but I'm getting into a mess....
I need to take old.png, resize to 400x400, and overlay a watermark (wmark.png), to create new.png.
This works:
Code: Select all
composite -gravity center "wmark.png" \( "old.png" -resize 400x400 \) "wmark.png" "new.png"
However, I would like to control the opacity of the overlaid wmark.png and I can't see how to do that.
Feel free to throw away what I have already! I've struggled to achieve both the resize and the overlay in one step.
Re: Controlling opacity when overlaying an image
Posted: 2010-06-02T07:54:43-07:00
by Bonzo
Have you tried -watermark
Code: Select all
composite -watermark 30% -gravity center watermark.png input.jpg output.png
To combine both you will need to "pipe" the result of one to the other with something like ( this probably will not work as is ! ):
Code: Select all
convert input.jpg -resize 500x500 miff:- | composite -watermark 30% -gravity center watermark.png - output.png
Re: Controlling opacity when overlaying an image
Posted: 2010-06-02T10:20:21-07:00
by hollymcr
Bonzo wrote:Have you tried -watermark
I have but I've never got the hang of it.
Bonzo wrote:
To combine both you will need to "pipe" the result of one to the other with something like ( this probably will not work as is ! ):
Code: Select all
convert input.jpg -resize 500x500 miff:- | composite -watermark 30% -gravity center watermark.png - output.png
[/quote]
It's a great starting point, as it does work!
However, I'm not sure what criteria define a suitable wmark.png when using this method, as the results are poor with the watermark image I am using. If I remove the -watermark I get similar results as I was getting before, I'm just still stuck on the opacity of the watermark.
Experimenting a little more, however, gets me something which does work using -dissolve:
Code: Select all
convert input.jpg -resize 500x500 miff:- | composite -dissolve 30% -gravity center watermark.png - output.png
So thanks for your method, it got me there in the end!
Re: Controlling opacity when overlaying an image
Posted: 2010-06-02T20:48:52-07:00
by anthony
Annotating, Watermarking Images..
http://www.imagemagick.org/Usage/annota ... termarking
This is one of the oldest set of Examples in IM Examples!