Skip to content

Commit

Permalink
don't store empty exif profiles (forcing the use of JXL container) (#77)
Browse files Browse the repository at this point in the history
Image.getexif().tobytes() always returns a non empty string. The truth value of
the Exif object should be used instead.
  • Loading branch information
Piezoid authored Oct 11, 2024
1 parent 624a98c commit 071bc7c
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion pillow_jxl/JpegXLImagePlugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,10 @@ def _save(im, fp, filename, save_all=False):
with open(im.filename, "rb") as f:
data = enc(f.read(), im.width, im.height, jpeg_encode=True)
else:
exif = info.get("exif", im.getexif().tobytes())
exif = info.get("exif")
if exif is None:
exif = im.getexif()
exif = exif.tobytes() if exif else None
if exif and exif.startswith(b"Exif\x00\x00"):
exif = exif[6:]
metadata = {
Expand Down

0 comments on commit 071bc7c

Please sign in to comment.