From 29921eeabde1a2f9eb31f1383e5a820d9772c333 Mon Sep 17 00:00:00 2001 From: Johannes Schauer Marin Rodrigues Date: Sun, 11 Jun 2023 21:56:21 +0200 Subject: [PATCH] the default PDF/A icc profile is /usr/share/color/icc/sRGB.icc, /usr/share/color/icc/OpenICC/sRGB.icc or /usr/share/color/icc/colord/sRGB.icc depending on which one exists --- src/img2pdf.py | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/src/img2pdf.py b/src/img2pdf.py index 6c58ea5..54701c9 100755 --- a/src/img2pdf.py +++ b/src/img2pdf.py @@ -3766,6 +3766,17 @@ def gui(): app.mainloop() +def get_default_icc_profile(): + for profile in [ + "/usr/share/color/icc/sRGB.icc", + "/usr/share/color/icc/OpenICC/sRGB.icc", + "/usr/share/color/icc/colord/sRGB.icc", + ]: + if os.path.exists(profile): + return profile + return "/usr/share/color/icc/sRGB.icc" + + def get_main_parser(): rendered_papersizes = "" for k, v in sorted(papersizes.items()): @@ -4036,10 +4047,13 @@ RGB.""", outargs.add_argument( "--pdfa", nargs="?", - const="/usr/share/color/icc/sRGB.icc", + const=get_default_icc_profile(), default=None, help="Output a PDF/A-1b compliant document. By default, this will " - "embed /usr/share/color/icc/sRGB.icc as the color profile.", + "embed either /usr/share/color/icc/sRGB.icc, " + "/usr/share/color/icc/OpenICC/sRGB.icc or " + "/usr/share/color/icc/colord/sRGB.icc as the color profile, whichever " + "is found to exist first.", ) sizeargs = parser.add_argument_group(