I'm using an older version of ImageMagick and I'm sure it makes me sound incompetent but how do I overlay one image on another where one is just a transparent png to force specific dimensions for the final image? Many of the documented examples use options which are not, apparently, available in this older version of IM.
I've tried convert -coalesce and composite etc. but I always end up with a background color in what should be transparent space. ... I'm overlaying a jpg on a blank transparent png, if that manes a difference.
Thanks
overlay image on transparent canvas ImageMagick-5.4.3.11-1
-
- Posts: 12159
- Joined: 2010-01-23T23:01:33-07:00
- Authentication code: 1151
- Location: England, UK
Re: overlay image on transparent canvas ImageMagick-5.4.3.11
I don't have a version that old, but this might work:
If you output to a format that doesn't support transparency, like jpg, you will lose the transparency.
Code: Select all
convert large.png small.jpg -composite out.png
snibgo's IM pages: im.snibgo.com
- fmw42
- Posts: 25562
- Joined: 2007-07-02T17:14:51-07:00
- Authentication code: 1152
- Location: Sunnyvale, California, USA
Re: overlay image on transparent canvas ImageMagick-5.4.3.11
that old IM version would probably need the composite command and not convert. you would be well of if you can upgrade (that version is about 1400 versions old)
composite -compose over small large_transparent result
see
http://www.imagemagick.org/Usage/basics/#cmdline
http://www.imagemagick.org/Usage/layers/#composite
http://www.imagemagick.org/Usage/compose/#compose
composite -compose over small large_transparent result
see
http://www.imagemagick.org/Usage/basics/#cmdline
http://www.imagemagick.org/Usage/layers/#composite
http://www.imagemagick.org/Usage/compose/#compose
Re: overlay image on transparent canvas ImageMagick-5.4.3.11
Thanks guys - yes - composite -compose ... worked well - ... actually, it turns out, so did convert -coalesce large-transparent small-overlay -flatten output - I had just viewed the result with the browser directly but, in a rendered page, it was fine - sorry
yes - I'm not completely sure why the admin chose the old version to install?? something about an old server... I'll look into it more.
Thanks again!
yes - I'm not completely sure why the admin chose the old version to install?? something about an old server... I'll look into it more.
Thanks again!
- anthony
- Posts: 8883
- Joined: 2004-05-31T19:27:03-07:00
- Authentication code: 8675308
- Location: Brisbane, Australia
Re: overlay image on transparent canvas ImageMagick-5.4.3.11
If the image you are overlaying on is transparent why not do this..
Code: Select all
convert layer_image.png -background none -extent WIDTHxHEIGHT+X+Y enalrged_canvas_image.png
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
https://imagemagick.org/Usage/