combining png over jpg

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
antitrust007

combining png over jpg

Post by antitrust007 »

Hi,

I have 2 images one jpg and one png
Image
Image
and need the result jpg like this
Image

Please help :)

Best regards.
antitrust007

Re: combining png over jpg

Post by antitrust007 »

I tried using
composite -compose add -quality 100 -geometry 828x1260 text.png image.jpg new.jpg
the problem is the quality is very pour :|
el_supremo
Posts: 1015
Joined: 2005-03-21T21:16:57-07:00

Re: combining png over jpg

Post by el_supremo »

Code: Select all

convert  image.jpg ( -transparent white  text.png ) -composite -quality 100 new.jpg
Pete
antitrust007

Re: combining png over jpg

Post by antitrust007 »

el_supremo wrote:

Code: Select all

convert  image.jpg ( -transparent white  text.png ) -composite -quality 100 new.jpg
Pete
Thank you for your reply , now new problems appear , if I fave white text in the text.png the text will not show , and the quality is pour , is there something to do about that ?

Please advise.

Best regards,
Claudiu.
el_supremo
Posts: 1015
Joined: 2005-03-21T21:16:57-07:00

Re: combining png over jpg

Post by el_supremo »

I don't know how you could handle an image which has both black on white text and white on black text other than to do it in pieces.

As to the quality, the smaller text in text.png is not very good and I don't think ImageMagick can really do much to improve it. You might get a slightly better output image if you saved it as PNG.

Pete
User avatar
anthony
Posts: 8883
Joined: 2004-05-31T19:27:03-07:00
Authentication code: 8675308
Location: Brisbane, Australia

Re: combining png over jpg

Post by anthony »

If the background is white! DO NOT ADD IMAGES.
Image adding is used for blending images, it is not used for merging images with white backgrounds...

You should be using Multiply instead..
See http://imagemagick.org/Usage/compose/#multiply

Also the last example in Image annotation!
http://imagemagick.org/Usage/annotating/#overlay


I also would NOT just set white to transparency. While it will work parts of the image that fall on top of each other will not merge as you would expect.
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
User avatar
anthony
Posts: 8883
Joined: 2004-05-31T19:27:03-07:00
Authentication code: 8675308
Location: Brisbane, Australia

Re: combining png over jpg

Post by anthony »

antitrust007 wrote:If I have white text in the text.png the text will not show , and the quality is pour , is there something to do about that ?
That will require you to some how specify what white parts are important, and what are not important. For that you may need to use a masking image of some type.
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
Post Reply