Page 1 of 1

"paste" image on top of another

Posted: 2013-07-25T19:01:54-07:00
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.

Re: "paste" image on top of another

Posted: 2013-07-25T19:26:58-07:00
by snibgo
Don't use JPG files. The compression is lossy, which means the colours will change every time you save and re-read.

Re: "paste" image on top of another

Posted: 2013-07-25T21:25:05-07:00
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.