-
Notifications
You must be signed in to change notification settings - Fork 99
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
Keywords in originals get propagated in export #292
Comments
I'll look into this. --exiftool writes keywords to the following fields:
The documentation should be explicit about what it will do and a flag to control this would be useful. I'm in favor of never deleting metadata unless explicitly told to do so. Thus maybe a |
In my testing, when run with
That said, you can merge them already using the exiftool template:
This uses the template system to create exif keywords from the Photos keywords and the existing keywords in the file. |
Given the behavior is already to overwrite the existing metadata, maybe an option for |
This is interesting. I checked and yes, the keywords are generally overwritten also for me. I have pinpointed one of the files that have the issue and probably it is an issue with the original metadata. If I try to export a json sidecar for the json file it shows the expected metadata and the jpg file shows the metadata of the original file. This is good. If I try to apply the metadata with exiftool -json=picture.jpg.json picture.jpg then I get an error Adding either the exiftool flag -m (ignore minor error) or -F (fix) helps here. Here a new hypothesis on the problem: exiftool triggers an error that is somehow silently ignored in spite of error handling code in the exiftool wrapper and does not update the metadata for the file. If this is the issue then the solution would probably be one or more of:
|
Are you able to share the image and the associated json file? If so, you can email to rturnbull+git@gmail.com I'd like to see if it's a problem with the jpeg image or the output of osxphotos. I'll play around with -m and -F to see if it makes sense to add those as standard options. That makes me a little nervous as it could potentially cover a bug in osxphotos but I see the point that it would be best to make sure the --exiftool works even if there's a problem in the original photo. |
Hi @RhetTbull, Took me a bit to answer as I was running a few more tests on the whole library. I have exported the entire library with json sidecar files and then with an own script called Have discovered the following:
Point 3 also offers a way to reproduce the issue that osxphotos does not report errors from exiftool
Based on this analysis, it is probably 1 bug and 3 new features:
Hope it helps PS all the pictures of point 2 above have family members in them and I do not feel comfortable sharing. Nothing personal. |
I opened new issues for #1, #3 and the exiftool warnings/errors. The code for the latter is almost done. After reading the exiftool documentation I do not want to add -m or -F as defaults but these could be added via a new --exiftool-flags option. I've also not been able to test -m since I couldn't replicate a file that caused minor warnings. I'm very leery of implementing #2 as I'd have to have a guaranteed way of detecting this and then figuring out the correct extension. imghdr in the standard library does this but only for a subset of files. When accounting for RAW types, there are many dozens or more of file types that would need to be accounted for. I could add a flag that does this only if set, e.g. --fix-filetypes but would need to think about how to safely implement this as getting the extension for a given filetype isn't easy given the plethora of image filetypes. Currently, I use a Mac system call to get the file extension given the UTI in the database but again, in your case, that's wrong. This also complicates the --update process as I need to keep track of multiple filenames (original and fixed). I'll have to think on this one some more. |
Thank you! On point 2, fully agree with what you wrote, thought the same. One possible idea is to do so only when using -exiftool and rely on the error of -exiftool. This would cost 1 extra call to exiftool for the files that are impacted. A more advanced version of this idea might rise a warning when osxphotos changes an extension and include a flag to opt-out (or to opt-in) the automatic extension correction. Just my two cents here - I see this as a workaround for incorrect behaviour of Apple Photos. |
This might help as it detects more types than imghdr: Also, exiftool can do this: But adding this to the code would take some work due to where exiftool gets called in the flow. Will keep thinking about this. |
Also, it would be possible to use my photoscript library along with osxphotos to write a script that finds all the incorrect file extensions in Photos and re-imports those photos with correct extension while re-applying all metadata in Photos. You'd lose edit history though. |
Thank you, I have already cleaned up the library! |
@finestream release v0.38.7 will now report all exiftool errors and will report exiftool warnings when run with --verbose. Additionally, if you use the --report option, the resulting CSV file will have two new columns: |
@finestream New feature 1: add an option to pass additional parameters to exiftools: added in v0.38.9 |
Implemented in v0.38.18 with |
*** Neat piece of software - thank you for developing and sharing it ***
If an original in macOS photo app has keywords (set before importing by some other program) and these keywords were later removed within photos, they still appear in the exported files.
used command line:
osxphotos export --update --touch-file --exiftool --ignore-date-modified --album-keyword --cleanup --filename {created.date}_{created.hour}.{created.min}.{created.sec} --directory {created.year}/{created.mm} .
Possible reason:
Possible solution:
The text was updated successfully, but these errors were encountered: