找回密码
 立即注册

QQ登录

只需一步,快速开始

扫一扫,访问微社区

查看: 40|回复: 0

[原创] 关于图像元数据读写处理的相关函数用法

[复制链接]

已领礼包: 145个

财富等级: 日进斗金

发表于 4 天前 | 显示全部楼层 |阅读模式

马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。

您需要 登录 才可以下载或查看,没有账号?立即注册

×
去下载 2025.03.18 的API


1. 图像EXIF 元数据查询,支持通配符,正则
xdrx-image-meta->exif


  1. Command: (xdrx-image-meta->exif "z:\\经纬度照片.jpg")

(("ApertureValue" "F8") ("BodySerialNumber" "0K8TGBL0121516") ("ColorSpace" "1") ("Contrast" "2") ("DateTime" "2022:05:09 12:14:51")
...
("WhiteBalance" "0") ("XResolution" "300") ("YResolution" "300"))

  1. Command: (xdrx-image-meta->exif "z:\\经纬度照片.jpg" "gps*")

(("GPSAltitude" "121 m") ("GPSAltitudeRef" "0") ("GPSLatitude" "41.878303916667") ("GPSLatitudeRef" "N") ("GPSLongitude" "124.039363305556") ("GPSLongitudeRef" "E") ("GPSTag" "778") ("GPSVersionID" "2"))

  1. Command: (xdrx-image-meta->exif "z:\\经纬度照片.jpg" GPSLongitude,GPSLongitude")

(("GPSLatitude" "41.878303916667") ("GPSLongitude" "124.039363305556"))

2. 读取图片XMP元数据,支持正则查找
xdrx-image-meta->xmp


  1. Command: (xdrx-image-meta->xmp "z:\\经纬度照片.jpg" "GPS*")

(("GpsLatitude" "+41.8783039") ("GpsLongitude" "+124.0393633"))


  1. Command: (xdrx-image-meta->xmp "z:\\经纬度照片.jpg")

(("AbsoluteAltitude" "+121.30") ("AlreadyApplied" "True") ("AutoLateralCA" "0")
...
("GpsLatitude" "+41.8783039") ("GpsLongitude" "+124.0393633")

3. 读取图片IPTC元数据,支持正则查找
xdrx-image-meta->iptc

  1. Command: (xdrx-image-meta->iptc "z:\\经纬度照片.jpg")

(("DateCreated" "2022-05-08") ("RecordVersion" "2") ("TimeCreated" "05:35:58+00:00"))


4. 集成了 exif, xmp, iptc 三个元数据 查找的 GPS相关的信息(GPS信息在 exif,xmp,iptc里面可能都有TAG)
xdrx-image-meta->gps

  1. Command: (xdrx-image-meta->gps "z:\\经纬度照片.jpg")



((("CameraSettings" ("ApertureValue" "F8") ("ExposureTime" "1/500 s") ("FNumber" "F8") ("FocalLength" "10.3 mm") ("FocalLengthIn35mmFilm" "28") ("LensModel" "28.0 mm f/2.8") ("LightSource" "1") ("Make" "Hasselblad") ("Model" "L1D-20c") ("ShutterSpeedValue" "1/500 s") ("Software" "Adobe Photoshop 23.1 (Windows)") ("WhiteBalance" "As Shot"))) (("GPS" ("GPSAltitude" "121 m") ("GPSAltitudeRef" "0") ("GPSLatitude" "41.878303916667") ("GPSLongitude" "124.039363305556"))) (("ImageDimensions" ("PixelXDimension" "5464") ("PixelYDimension" "3640") ("XResolution" "600") ("YResolution" "600"))) (("Orientation" ("FlightPitchDegree" "-2.80") ("FlightRollDegree" "-3.00") ("FlightYawDegree" "+92.70") ("GimbalPitchDegree" "+6.30") ("GimbalRollDegree" "+0.00") ("GimbalYawDegree" "+90.20"))))


5.一个集成了 ExifTool 所有功能的函数。
Command:xdrx-image<->exiftool

它可以读写图像元数据,操作一切,具体可以向 AI 询问。
例如:使用 ExifTool 设置图像分辨率。

你可以使用 ExifTool 读写图像的元数据,例如修改图像的分辨率。

下面是一些具体的操作示例:

**1. 查看图像的所有元数据**
查看图像的所有元数据,包括Exif、GPS等信息。
命令:
exiftool image.jpg
  1. (xdrx-image<->exiftool "image.jpg")

**2. 设置图像的原始日期和时间**
设置图像的拍摄日期和时间为指定的时间。
命令:
exiftool -DateTimeOriginal="2023:05:15 10:30:00" image.jpg
  1. (xdrx-image<->exiftool "-DateTimeOriginal=2023:05:15 10:30:00 image.jpg")

**3. 设置图像的作者**
设置图像的作者为“John Doe”。
命令:
exiftool -Artist="John Doe" image.jpg
  1. (xdrx-image<->exiftool "-Artist=John Doe image.jpg")

**4. 设置图像的标题**
设置图像的标题为“Vacation Photo”。
命令:
exiftool -Title="Vacation Photo" image.jpg
  1. (xdrx-image<->exiftool "-Title=Vacation Photo image.jpg")

**5. 设置图像的GPS坐标**
设置图像的GPS经纬度为(40.712776, -74.005974)。
命令:
exiftool -GPSLatitude=40.712776 -GPSLongitude=-74.005974 image.jpg
  1. (xdrx-image<->exiftool "-GPSLatitude=40.712776 -GPSLongitude=-74.005974 image.jpg")

**6. 设置图像分辨率**
设置图像的分辨率为300 DPI,单位为英寸。
命令:
exiftool -XResolution=300 -YResolution=300 -ResolutionUnit=inches image.jpg
  1. (xdrx-image<->exiftool "-XResolution=300 -YResolution=300 -ResolutionUnit=inches image.jpg")

**7. 设置图像的作者并覆盖原文件**
设置图像的作者为“John Doe”,并覆盖原文件。
命令:
exiftool -Artist="John Doe" -overwrite_original *.jpg
  1. (xdrx-image<->exiftool "-Artist=John Doe -overwrite_original *.jpg")

**8. 清除图像的GPS信息并覆盖原文件**
清除图像的所有GPS信息,并覆盖原文件。
命令:
exiftool -GPS:all= -overwrite_original image.jpg
  1. (xdrx-image<->exiftool "-GPS:all= -overwrite_original image.jpg")

**9. 清除所有元数据并覆盖原文件**
清除图像的所有元数据,并覆盖原文件。
命令:
exiftool -all= -overwrite_original image.jpg
  1. (xdrx-image<->exiftool "-all= -overwrite_original image.jpg")

**10. 查看图像的曝光时间、光圈和ISO**
查看图像的曝光时间、光圈值和ISO信息。
命令:
exiftool -ExposureTime -FNumber -ISO image.jpg
  1. (xdrx-image<->exiftool "-ExposureTime -FNumber -ISO image.jpg")

**11. 设置图像的版权信息**
设置图像的版权信息为“© 2023 John Doe”。
命令:
exiftool -Copyright="© 2023 John Doe" image.jpg
  1. (xdrx-image<->exiftool "-Copyright=© 2023 John Doe image.jpg")

**12. 重命名图像文件,使用拍摄日期和原文件名**
根据图像的拍摄日期和原文件名重命名文件。
命令:
exiftool -Filename<DateTimeOriginalFilename image.jpg
  1. (xdrx-image<->exiftool "-Filename<DateTimeOriginalFilename image.jpg")

**13. 查看所有Exif信息**
查看图像的所有Exif信息。
命令:
exiftool -Exif:all image.jpg
  1. (xdrx-image<->exiftool "-Exif:all image.jpg")

**14. 设置图像的颜色空间**
设置图像的颜色空间为Adobe RGB。
命令:
exiftool -ColorSpace="Adobe RGB" image.jpg
  1. (xdrx-image<->exiftool "-ColorSpace=Adobe RGB image.jpg")

**15. 设置图像的曝光补偿**
设置图像的曝光补偿为+1。
命令:
exiftool -ExposureBiasValue=+1 image.jpg
  1. (xdrx-image<->exiftool "-ExposureBiasValue=+1 image.jpg")

**16. 查看图像的白平衡信息**
查看图像的白平衡信息。
命令:
exiftool -WhiteBalance image.jpg
  1. (xdrx-image<->exiftool "-WhiteBalance image.jpg")

**17. 设置图像的白平衡为“自动”**
设置图像的白平衡为自动。
命令:
exiftool -WhiteBalance="Auto" image.jpg
  1. (xdrx-image<->exiftool "-WhiteBalance=Auto image.jpg")

**18. 查看目录中的所有图像GPS信息**
查看目录中的所有图像的GPS信息。
命令:
exiftool -GPSLatitude -GPSLongitude -r /path/to/directory/
  1. (xdrx-image<->exiftool "-GPSLatitude -GPSLongitude -r /path/to/directory/")

**19. 清除目录中所有图像的元数据并覆盖原文件**
清除目录中所有图像的所有元数据,并覆盖原文件。
命令:
exiftool -all= -r -overwrite_original /path/to/directory/
  1. (xdrx-image<->exiftool "-all= -r -overwrite_original /path/to/directory/")

**20. 列出图像的所有标签**
列出图像的所有标签。
命令:
exiftool -list image.jpg
  1. (xdrx-image<->exiftool "-list image.jpg")

**21. 查看图像的缩略图**
查看图像的缩略图。
命令:
exiftool -ThumbnailImage image.jpg
  1. (xdrx-image<->exiftool "-ThumbnailImage image.jpg")

**22. 将图像的元数据输出为CSV格式**
将图像的元数据输出为CSV格式并保存到文件。
命令:
exiftool -csv image.jpg > metadata.csv
  1. (xdrx-image<->exiftool "-csv image.jpg > metadata.csv")

**23. 设置图像的创建日期**
设置图像的创建日期为指定的时间。
命令:
exiftool -CreateDate="2023:05:15 10:30:00" image.jpg
  1. (xdrx-image<->exiftool "-CreateDate=2023:05:15 10:30:00 image.jpg")

**24. 设置图像的创建日期并覆盖原文件**
设置图像的创建日期为指定的时间,并覆盖原文件。
命令:
exiftool -CreateDate="2023:05:15 10:30:00" -overwrite_original *.jpg
  1. (xdrx-image<->exiftool "-CreateDate=2023:05:15 10:30:00 -overwrite_original *.jpg")

**25. 设置图像的曝光时间**
设置图像的曝光时间为1/250秒。
命令:
exiftool -ExposureTime="1/250" image.jpg
  1. (xdrx-image<->exiftool "-ExposureTime=1/250 image.jpg")

**26. 查看视频的时长**
查看视频文件的时长。
命令:
exiftool -Duration video.mp4
  1. (xdrx-image<->exiftool "-Duration video.mp4")

**27. 设置图像的制造商和型号**
设置图像的制造商为“Canon”,型号为“EOS 5D Mark IV”。
命令:
exiftool -Make="Canon" -Model="EOS 5D Mark IV" image.jpg
  1. (xdrx-image<->exiftool "-Make=Canon -Model=EOS 5D Mark IV image.jpg")

其他的用法,可以去問deepseek


论坛插件加载方法
发帖求助前要善用【论坛搜索】功能,那里可能会有你要找的答案;
如果你在论坛求助问题,并且已经从坛友或者管理的回复中解决了问题,请把帖子标题加上【已解决】;
如何回报帮助你解决问题的坛友,一个好办法就是给对方加【D豆】,加分不会扣除自己的积分,做一个热心并受欢迎的人!
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

QQ|申请友链|Archiver|手机版|小黑屋|辽公网安备|晓东CAD家园 ( 辽ICP备15016793号 )

GMT+8, 2025-3-23 04:07 , Processed in 0.412160 second(s), 30 queries , Gzip On.

Powered by Discuz! X3.5

© 2001-2025 Discuz! Team.

快速回复 返回顶部 返回列表