-
Notifications
You must be signed in to change notification settings - Fork 195
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[HOW-TO] Is there a way to add / update exif metadata #545
Comments
Hi, thanks for the question. Indeed, I don't think there's a built-in way to accomplish this at the moment, and as you've discovered, you can't add arbitrary values to the image metadata and have the code understand what to do with them. We can look into the question, but in the meantime is there a workaround where you write the JPEG to a memory buffer, then use one of Python's EXIF packages to amend it, and then re-save it to file? |
Hi, thanks for the quick reply. Yes - currently doing a call out to exiv2. Would be really nice if at least DateTime / DateTimeOriginal was written by picamera2. |
Yes, I'll certainly add the dates. For adding custom info, that probably just needs a bit of plumbing. We'll put it on the list! |
Brilliant, thank you. |
I'd like to second this. The problem with patching the EXIF after file generation is that you tend to end up compressing the file twice. |
Hi, there was a PR to add some extra functionality in this area (#786), though it seems to be a bit stalled at the moment. Although not ideal, it should be possible in the meantime to update just the exif tags using either Python or something like exiftool without re-encoding. |
I would like to augment the JPEG image file with additional metadata, specifically GPS location and the time that the photo was taken. I can add these via e.g. exiv2 (
Exif.Image.DateTime
,Exif.Image.DateTimeOriginal
,Exif.GPSInfo.GPSLatitudeRef
,Exif.GPSInfo.GPSLatitude
,Exif.GPSInfo.GPSLongitudeRef
,Exif.GPSInfo.GPSLongitude
), however, I cannot see a way to add directly.I have tried altering the metadata in a pre_callback method but without luck, e.g. :
The text was updated successfully, but these errors were encountered: