mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Kindle output: Only re-encode JPEG images with EXIF metadata if the metadata contains actual transpose operations. Fixes #2023189 [[EPUB->MOBI] Calibre MOBI file Size too small](https://bugs.launchpad.net/calibre/+bug/2023189)
This commit is contained in:
parent
92d62bf9f1
commit
812fecec5f
@ -27,9 +27,11 @@ def process_jpegs_for_amazon(data: bytes) -> bytes:
|
|||||||
# Amazon's MOBI renderer can't render JPEG images without JFIF metadata
|
# Amazon's MOBI renderer can't render JPEG images without JFIF metadata
|
||||||
# and images with EXIF data dont get displayed on the cover screen
|
# and images with EXIF data dont get displayed on the cover screen
|
||||||
changed = not img.info
|
changed = not img.info
|
||||||
if hasattr(img, '_getexif') and img._getexif():
|
if hasattr(img, 'getexif'):
|
||||||
changed = True
|
exif = img.getexif()
|
||||||
img = ImageOps.exif_transpose(img)
|
if exif.get(0x0112) in (2,3,4,5,6,7,8):
|
||||||
|
changed = True
|
||||||
|
img = ImageOps.exif_transpose(img)
|
||||||
if changed:
|
if changed:
|
||||||
out = BytesIO()
|
out = BytesIO()
|
||||||
img.save(out, 'JPEG')
|
img.save(out, 'JPEG')
|
||||||
|
Loading…
x
Reference in New Issue
Block a user