Hi,
I will add this change to kindleunpack.py as well so that it operates correctly even without operating inside a calibre environment.
It will appear in the upcoming KindleUnpack v0.63.
Thank you!
Kevin
Quote:
Originally Posted by NiLuJe
That said, there's no JFIF, EXIF or 8BIM anywhere in that file, so Kovid's tweaked imghdr doesn't catch it either. To keep false-positives at bay, I tweaked my extra check a bit:
Code:
# imghdr only checks for JFIF or Exif JPEG files. Apparently, there are some with only the magic JPEG bytes out there...
# ImageMagick handle those, so, do it too.
if imgtype is None and data[0:2] == b'\xFF\xD8':
# Get last non-null bytes
last = len(data)
while (data[last-1:last] == b'\x00'):
last-=1
# Be extra safe, check the trailing bytes, too.
if data[last-2:last] == b'\xFF\xD9':
imgtype = "jpeg"
|