ignore RGB icc profile for grayscale jpegs produced by SmartAlbums
closes: #175
This commit is contained in:
parent
09064e8e70
commit
f157ced05d
1 changed files with 20 additions and 0 deletions
|
@ -1478,6 +1478,26 @@ def get_imgmetadata(
|
|||
)
|
||||
logger.warning("https://gitlab.gnome.org/GNOME/gimp/-/issues/3438")
|
||||
iccp = None
|
||||
# SmartAlbums old version (found 2.2.6) exports JPG with only 1 compone
|
||||
# with an RGB ICC profile which is useless.
|
||||
# This produces an error in Adobe Acrobat, so we ignore it with a warning.
|
||||
if iccp is not None and (
|
||||
(color == Colorspace["L"] and imgformat == ImageFormat.JPEG)
|
||||
):
|
||||
exifsoft = None
|
||||
if hasattr(imgdata, "_getexif") and imgdata._getexif() is not None:
|
||||
for tag, value in imgdata._getexif().items():
|
||||
if TAGS.get(tag, tag) == "Software":
|
||||
exifsoft = value
|
||||
with io.BytesIO(iccp) as f:
|
||||
prf = ImageCms.ImageCmsProfile(f)
|
||||
if (prf.profile.model and "sRGB" in prf.profile.model) and (
|
||||
exifsoft and "SmartAlbums" in exifsoft
|
||||
):
|
||||
logger.warning(
|
||||
"Ignoring RGB ICC profile in Grayscale JPG created by SmartAlbums"
|
||||
)
|
||||
iccp = None
|
||||
|
||||
logger.debug("width x height = %dpx x %dpx", imgwidthpx, imgheightpx)
|
||||
|
||||
|
|
Loading…
Reference in a new issue