From d422a7bad4c68927da565b1cb0a682afde586377 Mon Sep 17 00:00:00 2001 From: Raphael Stefanini Date: Thu, 5 Sep 2024 06:35:45 +0300 Subject: [PATCH] Handle empty string as None for metadata --- pillow_jxl/JpegXLImagePlugin.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/pillow_jxl/JpegXLImagePlugin.py b/pillow_jxl/JpegXLImagePlugin.py index 7021572..61415d9 100644 --- a/pillow_jxl/JpegXLImagePlugin.py +++ b/pillow_jxl/JpegXLImagePlugin.py @@ -121,9 +121,9 @@ def _save(im, fp, filename, save_all=False): if exif and exif.startswith(b"Exif\x00\x00"): exif = exif[6:] metadata = { - "exif": exif, - "jumb": info.get("jumb"), - "xmp": info.get("xmp"), + "exif": exif or None, + "jumb": info.get("jumb") or None, + "xmp": info.get("xmp") or None, } data = enc(im.tobytes(), im.width, im.height, jpeg_encode=False, **metadata) fp.write(data)