According to the documentation, you can create a transparent png file using the "image data.mask" element of "Write PNG File.vi". As far as I can tell, the mask is completely ignored: images created with mask set to an empty array are bytewise-identical to those created with a mask that is a mix of 1s and 0s. Has anyone successfully created a PNG image with transparency using this function?
I'm using LV 2009 SP1.
Where in the help (labVIEW 2009 version) do you find that info?
Don't be fooled by the Type description of the image cluster, that only describes how the image indicator deals with it. I think that if you want to create a PNG with transparency info you should set the upper byte of the 24-bit (actual 32 bit) image format.
here's some quick mock up of what I'm talking about.
It produces a valid PNG and using paint.net I feel it is what I expected, but I am not sure.
Thanks to Ton I have gone and learned something today. A few years back (I have lost count) I wrote a set of PNG encoders/decoders because LV support for PNG files was marginal at best. No alpha support, no buffer based manipulation, just file reading and writing (of certain types). As such I have eschewed the LV VIs for the most part. Now it seems that you can at least trick LabVIEW into writing the transparency information.
If you specify a bit depth of 32, the image array is arranged alpha-R-G-B for each pixel. If you have a mask, you can convert it to a 1-bit pixmap and use alpha values of 255 or 0 for each pixel, and at least have crude transparency. Here is my (now much simplified) VI to save the image data with transparency. If you give it a 24-bit image with a non-empty mask array it will add the proper values to the alpha channel and promote the image to 32-bit for saving.