Page 1 of 1

How to give background to the png at a particular area

Posted: 2013-06-13T08:20:07-07:00
by nasaa1
Hi,

I have this image - Image http://postimg.org/image/xmlwkmec5/f5325cd6/

I was wondering if I can hide the transparency or give a white background to only selected area and not the whole image.

Any idea will be highly appreciated.

Regards

Re: How to give background to the png at a particular area

Posted: 2013-06-13T10:08:58-07:00
by fmw42
The image that is there to download is jpg and thus has no transparency.

Nevertheless, if you just want to change any full transparency to some color, say white, then just flatten it against a white background

convert yourimage -background white -flatten result

If that is not what what you want please explain in more detail. Also identify your IM version and platform.

Re: How to give background to the png at a particular area

Posted: 2013-06-13T10:13:22-07:00
by nasaa1
Apologies for the wrong image

Image

I want to get rid of the transparency from certain part of image and not the whole image. So in this case I would like to get rid of transparency from the "RADIO TIMES" Text

Re: How to give background to the png at a particular area

Posted: 2013-06-13T11:35:45-07:00
by fmw42
Extract the alpha channel

convert flatten_canvas2.png -alpha extract 1tmp1.png

Then draw a white filled polygon over the area you want to make opaque in the alpha image.

see
http://www.imagemagick.org/Usage/draw/#primitives

Then replace the alpha channel in the original image with the new alpha channel image

convert flatten_canvas2.png newalphaimage.png -alpha off -compose copy_opacity -composite result.png