Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

To resolve issues starting MATLAB on Mac OS X 10.10 (Yosemite) visit: http://www.mathworks.com/matlabcentral/answers/159016

How to add alpha channel to the image and convert that image into png format?

Asked by goldensona on 30 Dec 2012

Hi i want to combine image with the alpha channel having 100%opacity no color it. and after some processing i have to remove the aplha channel .how to remove it can anyone help me to do.

0 Comments

goldensona

Products

No products are associated with this question.

2 Answers

Answer by Walter Roberson on 31 Dec 2012
Accepted answer
imwrite(RGBarray, filename, 'png', 'Alpha', ones(size(RGBarray,1),size(RGBarray,2)) )

When you imread(), use

[RGBdata, map, alpha] = imread(filename, 'png');

Note: this is specific to PNG files. A couple of other image formats handle Alpha this way, but some of the other image formats handle Alpha in other ways.

6 Comments

Walter Roberson on 2 Jan 2013

What do you mean by "superimposing" in this situation?

goldensona on 2 Jan 2013

for image editing purpose, use superimposing or painting ,if i use photoshop to change it will destroy pixel value

Walter Roberson on 2 Jan 2013

If you change the RGB array values of the image, then they are changed just like with photoshop.

You can display one image on top of another, but it does not sound like you want to do that.

Walter Roberson
Answer by Image Analyst on 31 Dec 2012

I'm not sure exactly what you mean. Do you just want to put stuff in the overlay, like with functions plot(), line(), patch(), annotation(), etc. and be able to turn them on or off? Or do you want to save stuff you put in the overlay, say burned into the image and saved as a disk file with export_fig()? Or do you want to do what Walter suggested?

31 Comments

goldensona on 16 Jan 2013

its easy to use alpha channel in photoshop

goldensona on 27 Jan 2013

can any one tell about tampering localization capability ?

Walter Roberson on 28 Jan 2013

Maybe, if it were defined. But it sounds like something that should be analyzed through theory (which is outside the scope of this forum), or else through experimentation.

Image Analyst

Contact us