gpt4 book ai didi

python - 在 Python 中从 TIF 图像读取和写入 exif 元数据

转载 作者:行者123 更新时间:2023-12-01 04:29:07 26 4
gpt4 key购买 nike

我正在寻找 Python 中的库或特定函数,以通过数码相机从 TIFF 图像中读取和写入 exif 元数据

我的 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

如果我用Python使用comumn库(es: tifffile)读写,我会丢失我的元数据

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

最佳答案

您可以使用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')

关于python - 在 Python 中从 TIF 图像读取和写入 exif 元数据,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32641075/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com