"paste" image on top of another

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
JLuehman
Posts: 2
Joined: 2013-07-25T18:39:57-07:00
Authentication code: 6789

"paste" image on top of another

Post by JLuehman »

I am trying to "paste" one image on top of another without the colour of the "pasted" image being changed at all.

It seems to work fine if i use a plain white image like so:
convert -quality 100% -size 715x156 xc:white "testnew.jpg"
convert -quality 100% -background none -virtual-pixel transparent -pointsize 40 -font "Open_Sans.ttf" -fill "#e66956" label:"Testing" "label.png"
composite -quality 100% -geometry +50+50 "label.png" "testnew.jpg" "testnew.jpg"
Image

But if i use a different image that has some other colour in it, the colours in the "pasted" imaged get modified (there are some dark edges added):
convert -quality 100% "526org_1370178839.jpg" "testnew.jpg"
convert -quality 100% -background none -virtual-pixel transparent -pointsize 40 -font "Open_Sans.ttf" -fill "#e66956" label:"Testing" "label.png"
composite -quality 100% -geometry +50+50 "label.png" "testnew.jpg" "testnew.jpg"
Image

I want the text to be copied exactly as it is, over the top without it changing colour.

Thanks for any help.
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: "paste" image on top of another

Post by snibgo »

Don't use JPG files. The compression is lossy, which means the colours will change every time you save and re-read.
snibgo's IM pages: im.snibgo.com
JLuehman
Posts: 2
Joined: 2013-07-25T18:39:57-07:00
Authentication code: 6789

Re: "paste" image on top of another

Post by JLuehman »

Thank you!

I have changed my program to use PNG files now, and only convert to JPG once at the end when needed.

I was adding multiple label images to the original which was causing the text to look horrible. Now it looks much better.
Post Reply