当前位置:网站首页>Modify EXIF information
Modify EXIF information
2022-06-29 09:16:00 【Duanmucheng】
from PIL import Image
import piexif
#https://pypi.org/project/piexif/1.0.8/
#https://piexif.readthedocs.io/en/latest/functions.html
# Remove all
#piexif.remove("foo.jpg")
im = Image.open("./lala.jpg")
exif_dict = piexif.load(im.info["exif"])
print(type(exif_dict), exif_dict)
for ifd in ("0th", "Exif", "GPS", "1st"):
for tag in exif_dict[ifd]:
print(piexif.TAGS[ifd][tag], exif_dict[ifd][tag])
exif_dict["0th"][piexif.ImageIFD.Artist] = " This is the author ".encode()
exif_dict["Exif"][piexif.ExifIFD.DateTimeOriginal] = '9999:09:09 09:09:09'.encode()
exif_dict["Exif"][piexif.ExifIFD.LensModel] = 'here'.encode()
exif_dict["Exif"][piexif.ExifIFD.LensMake] = 'wow'.encode()
exif_bytes = piexif.dump(exif_dict)
im.save("lala2.jpg", exif=exif_bytes)
print('------------------------------ After modification -----------------------------------')
for ifd in ("0th", "Exif", "GPS", "1st"):
if ifd is "0th":
print('------------------------------0th-----------------------------------')
if ifd is "Exif":
print('------------------------------Exif-----------------------------------')
if ifd is "GPS":
print('------------------------------GPS-----------------------------------')
if ifd is "1st":
print('------------------------------1st-----------------------------------')
for tag in exif_dict[ifd]:
print(piexif.TAGS[ifd][tag], exif_dict[ifd][tag])
边栏推荐
- Network security issues
- Lffd: a lightweight fast face detector for edge detection
- 观察者模式怎么实现
- Keras to tf Vgg19 input in keras_ shape
- Mysql使用union all统计多张表组合总数,并分别统计各表数量
- 【目标检测】|指标 A probabilistic challenge for object detection
- 工厂模式
- Let's make a summary
- uniapp微信小程序报错 TypeError: Cannot read property ‘call‘ of undefined
- MYSQL行转列例子
猜你喜欢
随机推荐
Verilog reduction operator
Training kernel switching using GPU
Pointnet的网络学习
MT-yolov6训练及测试
Verilog size and +: Using
修改exif信息
LFFD:一种用于边缘检测的轻量化快速人脸检测器
Handwritten virtualdom
宏,函数和内联函数
io流的总结
Verilog splicing operation symbol
Unity C# 网络学习(十二)——Protobuf生成协议
专业结构record
Open3d farthest point sampling (FPS)
微信小程序项目:tab导航栏
成员内部类、静态内部类、局部内部类
Can we trust bounding box annotations for object detection
cmd进入虚拟机
递归方法 rbac菜单层级显示 无限极分类
Verilog 表达式









