Skip to main content
Known Participant
September 19, 2012
Question

Determine of a PNG image contains transparent pixels

  • September 19, 2012
  • 4 replies
  • 9892 views

Hi,

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?

This topic has been closed for replies.

4 replies

Harbs.
Legend
December 27, 2012

Umm...

That's all about ActionScript. Nowhere in your post did you indicate that you were using ActionScript. If you had, I might have suggested something similar.

Known Participant
December 28, 2012

Sorry Harbs, I just forgot to tell that!

Known Participant
December 27, 2012

Hi all,

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-contains-semi-transparent-pixel-using-as3/13570103

Community Expert
September 20, 2012

If PhotoShop is available, you could test for alpha through BridgeTalk in opening the png in PhotoShop and running a PhotoShop snippet, returning the result to the InDesign part of the script.

Uwe

Known Participant
September 19, 2012

You might be able to check against a certain alpha channel. Not sure, but might be a decent starting point.

http://jongware.mit.edu/idcs4js/pc_ClippingPathSettings.html

Known Participant
September 20, 2012

@caseyctg: Hm more info on how to do that please?

Harbs.
Legend
September 20, 2012

clippingPathSettings does not help with pngs. It's for images with "real" clipping paths (such as psd files).

There's no easy answer to your problem.