Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

How to recognise transparent images? #1226

Answered by mkl-public
jukkaharkki asked this question in Q&A
Discussion options

Using OpenPDF library I can scan through document objects, see images and even extract these images. However, I have not found a way to check if an image is transparent. The information is not within an individual image but rather in relationship of two images or layers I assume. But how to check this out?

I don't need to flatten transparency (I know there are tools for it), just identifying is enough. The big picture is about printing a PDF and there transparent images are not supported by the service provider. I'm trying to identify PDF documents containing transparent images and reject printing.

Any hint appreciated

You must be logged in to vote

When you inspect the objects a PDF consists of, you should have a copy of the current specification at your hand, ISO 32000-2. You can get a free copy at the PDF association, see https://www.pdfa-inc.org/product/iso-32000-2-pdf-2-0-bundle-sponsored-access/

In section 8.9.5 you'll find the image dictionaries explained. In particular the entries ImageMask, Mask, and SMask. Beware, though, transparency can also be achieved for regions of a PDF page which by chance may contain images, e g. by clip paths and general graphics state SMasks.

Replies: 1 comment 1 reply

Comment options

When you inspect the objects a PDF consists of, you should have a copy of the current specification at your hand, ISO 32000-2. You can get a free copy at the PDF association, see https://www.pdfa-inc.org/product/iso-32000-2-pdf-2-0-bundle-sponsored-access/

In section 8.9.5 you'll find the image dictionaries explained. In particular the entries ImageMask, Mask, and SMask. Beware, though, transparency can also be achieved for regions of a PDF page which by chance may contain images, e g. by clip paths and general graphics state SMasks.

You must be logged in to vote
1 reply
Comment options

Thanks, that led me to the right direction. Eventually I did very rudimentary test: if image has a mask, then it is part of transparency. Probably not 100% accurate but serves my purpose and worked with few test cases.

Answer selected by jukkaharkki
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet

AltStyle によって変換されたページ (->オリジナル) /