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.
file
gives you this information. Doesn't it output RGB for non-transparent and RGBA for transparent? Or I'm sureconvert
can give you this information if you go through its (many) options!`
to mark your inline code as I did in my edit.identify
does the job.