I am trying to generate PDF/A-1 compliant documents, in which transparency is not allowed. I would like to check, if included PDF and PNG images have transparency.
Is there a TeX way to check this? Otherwise, what is the proper way to change the \includegraphics command to call external tools to check this?
Edit: External tools for checking transparency:
For PNGs, ImageMagik's identify does the job nicely. It displays [s]rgba when there is an alpha channel (otherwise it's rgb):
# identify -format '%[channels]' Transparent.png
srgba
Even better:
# identify -format %A Transparent.png
True
For PDFs, this is more complicated (see eg here): There are as graphical style attributes fill opacity (/ca) or stroke opacities (/CA) below a value of 1.0, or there is a soft mask (\SMask), or there is a transparency page group defined (/S /Transparency). grep expression:
grep -aE -e '/[Cc][Aa] +0?\.[0-9]' -e '/SMask' -e '/S /Transparency' *.pdf
I bet it is somehow possible to check with gs, but I did not find it so far.
filegives you this information. Doesn't it output RGB for non-transparent and RGBA for transparent? Or I'm sureconvertcan give you this information if you go through its (many) options! – cfr Jan 08 '14 at 00:37identifydoes the job. – Florian Bw Jan 08 '14 at 20:43