If your image has transparency, then imwrite(I, "name.png") should Just Work.

There are many ways to get an image with transparency: for example, you might 
load one from disk. If you want to construct one "from scratch," here's a 
demo:

    A = rand(100, 128, 4);                # random colors
    A[:,:,1] = linspace(0,1,100) .* ones(1,128);      # alpha gradient
    img = colorim(A, "ARGB")

This builds an ARGB image. You could alternatively choose an RGBA image if you 
prefer (for which A is the 4th channel).

--Tim


On Monday, June 23, 2014 10:00:44 PM Yakir Gagnon wrote:
> How, if possible, can I imwrite a PNG image that has transparency in it?
> I'm assuming something like:
> 
> using Images
> imwrite( I,"name.png",alpha=A)
> 
> Thanks!

Reply via email to