I'm exporting lots of PageItems to images using pageItem.export() method. I want the exported image to be a PNG if it contains transparent pixels, otherwise it should be a JPG.
So is there anyway to determine whether an exported PNG contains transparent pixels or not?
You might be able to check against a certain alpha channel. Not sure, but might be a decent starting point.
Image img = Image.FromFile ( "...", true );
if ( (img.Flags & 0x2) != 0)
bool ContainsTransparent(Bitmap image)
for (int y = 0; y < image.Height; ++y)
for (int x = 0; x < image.Width; ++x)
if (image.getPixel(x, y).A != 255)
I just found out some great solutions to this problem, please have a look here http://stackoverflow.com/questions/13568717/check-if-a-png-image-conta ins-semi-transparent-pixel-using-as3/13570103
Europe, Middle East and Africa