我正在寻找Python中的库或特定函数,以便通过数码相机从TIFF图像读取和写入exif metadata
我的16位TIFF格式的图片具有以下特征,与ImageMagick一致:
Properties:
date:create: 2015-09-02T16:01:49-06:00
date:modify: 2015-09-02T18:00:37-06:00
exif:ExposureTime: 0.00125
exif:FNumber: 2.8
exif:FocalLength: 16
exif:ISOSpeedRatings: 400
signature: e72808cba367184ab5c8f9c06d52701c7850e114155676857d2912b4743f243a
tiff:alpha: unspecified
tiff:artist:
tiff:endian: lsb
tiff:make: Sony
tiff:model: NEX-7
tiff:photometric: RGB
tiff:rows-per-strip: 1
tiff:software: dcraw v9.25
tiff:timestamp: 2014:07:28 08:34:56
如果我使用comumn libreries(es:tifffile)在Python中读写,我会丢失元数据
import tifffile as tiff
from skimage import io
myimage = 'C:\\foo.tiff'
image = tiff.imread(myimage)
io.imsave("C:\\foo_new.tiff", image)
表格ImageMagick
Properties:
date:create: 2015-09-17T15:58:07-06:00
date:modify: 2015-09-17T16:00:34-06:00
signature: e72808cba367184ab5c8f9c06d52701c7850e114155676857d2912b4743f243a
tiff:alpha: unspecified
tiff:endian: lsb
tiff:photometric: RGB
tiff:rows-per-strip: 1
tiff:software: tifffile.py
tiff:timestamp: 2015:09:17 16:00:27
答案 0 :(得分:2)
您可以使用Wand:
from wand.image import Image
with Image(filename='test.tif') as image:
for k, v in image.metadata.items():
print("{}: {}".format(k, v))
image.save(filename='copy.tif')