extend comments around dropping ICC profile stored by GIMP for bilevel input

This commit is contained in:
Johannes Schauer Marin Rodrigues 2023-06-08 07:21:46 +02:00
parent fc059ee471
commit e9e04b6dd9
Signed by: josch
GPG key ID: F2CBA5C78FBD83E1

View file

@ -1432,8 +1432,10 @@ def get_imgmetadata(
iccp = None iccp = None
if "icc_profile" in imgdata.info: if "icc_profile" in imgdata.info:
iccp = imgdata.info.get("icc_profile") iccp = imgdata.info.get("icc_profile")
# GIMP saves bilevel tiff images with an RGB ICC profile which # GIMP saves bilevel tiff images with an RGB ICC profile which is useless
# is useless and produces an error in Adobe Acrobat -- ignore it # and produces an error in Adobe Acrobat, so we ignore it with a warning.
# imagemagick also used to (wrongly) include an RGB ICC profile for bilevel
# images: https://github.com/ImageMagick/ImageMagick/issues/2070
if iccp is not None and color == Colorspace["1"] and imgformat == ImageFormat.TIFF: if iccp is not None and color == Colorspace["1"] and imgformat == ImageFormat.TIFF:
with io.BytesIO(iccp) as f: with io.BytesIO(iccp) as f:
prf = ImageCms.ImageCmsProfile(f) prf = ImageCms.ImageCmsProfile(f)
@ -1442,10 +1444,8 @@ def get_imgmetadata(
and prf.profile.manufacturer == "GIMP" and prf.profile.manufacturer == "GIMP"
and prf.profile.profile_description == "GIMP built-in sRGB" and prf.profile.profile_description == "GIMP built-in sRGB"
): ):
logger.warning( logger.warning("Ignoring RGB ICC profile in bilevel TIFF produced by GIMP.")
"Ignoring RGB ICC profile in bilevel TIFF produced by GIMP." logger.warning("https://gitlab.gnome.org/GNOME/gimp/-/issues/3438")
)
logger.warning("https://gitlab.gnome.org/GNOME/gimp/-/issues/9518")
iccp = None iccp = None
logger.debug("width x height = %dpx x %dpx", imgwidthpx, imgheightpx) logger.debug("width x height = %dpx x %dpx", imgwidthpx, imgheightpx)