Moustikitos / tyf

Manipulate EXIF and IFD metadata.
19 stars 8 forks source link

Error with InteropIFD : missing / corrupted after save #10

Closed u1735067 closed 7 years ago

u1735067 commented 7 years ago

I have an issue with the sub IFD InteropIFD : when I load a jpg and save it, it is missing or shown as corrupt in exiftool after (with this example, it's corrupted). I guess it's not the expected behaviour.

Before :

Interoperability Index          : R98 - DCF basic file (sRGB)
Interoperability Version        : 0100

after :

Warning                         : Bad InteropIFD directory

Steps :

jpg = Tyf.open('testori.jpg')
#Print some tags
for i in jpg.exif.tags():
    print(i)
# eventually, (re)write 3-4 tags
jpg.save('testinterop.jpg')

The source file might be corrupted, but it should be original from the smartphone.

Files : testori testinterop

Python 3.5.2 64bit Win

Moustikitos commented 7 years ago

Hi,

I did not implement interoperability subIFD. working on it, release to follow... Stay tuned!

Thanks for using my lib.

Moustikitos commented 7 years ago

Hi,

I fixed the issue.

>>> jpg = Tyf.open("issue #7.jpg")
>>> jpg.save("issue.7.jpg")
>>> jpg = Tyf.open("issue.7.jpg")
>>> jpg.exif
{272: <Tiff tag 0x110: Model = b'blade'>, 531: <Tiff tag 0x213: YCbCrPositioning = (1,)> := 'Centered', 296: <Tiff tag 0x128: ResolutionUnit = (2,)> := 'Inch', 34665: <Tiff tag 0x8769: Exif IFD = (147,)>, 282: <Tiff tag 0x11a: XResolution = (72, 1)>, 283: <Tiff tag 0x11b: YResolution = (72, 1)>, 271: <Tiff tag 0x10f: Make = b'CyanogenMod\x00'>}
>>> jpg.exif["Exif IFD"]
{36864: <Exif tag 0x9000: ExifVersion = b'0220'>, 37121: <Exif tag 0x9101: ComponentsConfiguration = b'\x01\x02\x03\x00'>, 40962: <Exif tag 0xa002: PixelXDimension = (2048,)>, 36867: <Exif tag 0x9003: DateTimeOriginal = b'2012:01:19 16:13:28\x00'>, 36868: <Exif tag 0x9004: DateTimeDigitized = b'2012:01:19 16:13:28\x00'>, 40965: <Exif tag 0xa005: Interoperability IFD = (301,)>, 40960: <Exif tag 0xa000: FlashpixVersion = b'0100'>, 40961: <Exif tag 0xa001: ColorSpace = (1,)> := 'RGB', 40963: <Exif tag 0xa003: PixelYDimension = (1536,)>}
>>> jpg.exif["Exif IFD"]["Interoperability IFD"]
{1: <Interop tag 0x1: InteropIndex = b'R98\x00'> := 'R98 - DCF basic file (sRGB)', 2: <Interop tag 0x2: InteropVersion = b'0100'>}

Keep me updated.