This commit is contained in:
hugovk 2014-07-30 19:39:11 +03:00
parent 4c5a5c1f0e
commit 515bb6e14d

View File

@ -21,7 +21,8 @@ __version__ = "0.3"
from PIL import Image, ImageFile, _binary
import os, tempfile
import os
import tempfile
i8 = _binary.i8
i16 = _binary.i16be
@ -35,17 +36,20 @@ COMPRESSION = {
PAD = o8(0) * 4
#
# Helpers
def i(c):
return i32((PAD + c)[-4:])
def dump(c):
for i in c:
print("%02x" % i8(i), end=' ')
print()
##
# Image plugin for IPTC/NAA datastreams. To read IPTC/NAA fields
# from TIFF and JPEG files, use the <b>getiptcinfo</b> function.
@ -200,14 +204,17 @@ class IptcImageFile(ImageFile.ImageFile):
im.load()
self.im = im.im
finally:
try: os.unlink(outfile)
except: pass
try:
os.unlink(outfile)
except:
pass
Image.register_open("IPTC", IptcImageFile)
Image.register_extension("IPTC", ".iim")
##
# Get IPTC information from TIFF, JPEG, or IPTC file.
#