#π Edit file metadata with Python
31 messages Β· Page 1 of 1 (latest)
@true falcon
Remember to:
- Ask your Python question, not if you can ask or if there's an expert who can help.
- Show a code sample as text (rather than a screenshot) and the error message, if you've got one.
- Explain what you expect to happen and what actually happens.
:warning: Do not pip install anything that isn't related to your question, especially if asked to over DMs.
Any advice is much appreciated
you presumably want to modify the exif data
so you'd want to roundtrip the images by reading them, setting the metadata, and then creating them. e.g. https://stackoverflow.com/questions/44636152/how-to-modify-exif-data-in-python
so im essentially recreating the photos then? Some of them have timestamps from many years ago, I hate to lose that but
timestamps, as in the file itself was created on your machine several years ago?
if the metadata inside them is the timestamp you're talking about, you can just leave that intact
Well, I copied the files from an old pc, but they retained their creation date
i wouldn't be attached to the creation date of a file, but if you wanted to you could just not modify the original file
and create a completely new one
or you could modify the metadata of the file itself
That's ideally what I'm wanting, I have about 500gb of photos, and I'm trying to add a tag to each photo as a sort of identifier to mark who the photo is of. After that I'm importing this info into a database table for a future project I'm working on
oh, why not just add the metadata as part of the importing step?
like instead of modifying the file, just doing it when you insert into the db
How might that work?
well, how are you inserting this info into a database?
just modify that flow to be the stage at which you identify who's in a photo
then in the database store that metadata separately
e.g. in a person_to_image join table
Haven't nailed it down yet, but once I finish organizing the photos, I'll run a script thst gets the file name, location, full location with file name, file type etc
instead of storing that information in the exif metadata
Well my only issue with that is, during the import step I'm not sure how to determine what tag to set for each photo unless I base it off the folder name, but then some folder names are related to trips, some photos may have multiple people
So one table for my photo info, another for the metadata?
that's just how i'd represent the many-to-one relationship of people inside a photo
at the very least, it sounds like storing this in the exif metadata is not necessary. you could just create a file that lives next to the image that is like a json manifest file containing metadata about the image
but only if you intend to query based on that information. you could also use e.g. a jsonb column in postgres
I'll look into that, I've actually never heard of that tor used it before
This help channel has been closed and it's no longer possible to send messages here. If your question wasn't answered, feel free to create a new post in #1035199133436354600. To maximize your chances of getting a response, check out this guide on asking good questions.