-
Notifications
You must be signed in to change notification settings - Fork 106
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
DNG being exported as TIFF #322
Comments
This is a bug. I think it's actually the DNG file (which exiftool reports as TIFF if it's labeled JPG) that's being output. I suspect there was an error in the file conversion code and it left the DNG file marked as JPG. I'll have to look into the error handling of the conversion code. |
The DNG is only 9.8MB. So there is actual conversion from DNG to TIFF happening here. And preview also opens the file as TIFF. |
Is the DNG file one you're willing to share with me? If so, email to rturnbull+git@gmail.com and I'll take a look in a test library. I just tried |
Emailed. Here is my command line - /usr/local/bin/osxphotos export --update --cleanup --not-hidden --not-shared --not-screenshot |
Got it -- will take a look later this weekend. |
I imported your test image into Photos then exported with your command and the export succeeds as expected. The DNG file is converted to a 12M jpeg file and the exiftool attributes are correctly written. I did see in the code that I don't check the result of the conversion method for success so I'll add code to capture any errors during conversion and report those which might help debug the issue you're having. |
v0.39.6 adds error handling for --convert-to-jpeg. If you get any error output during export, please post it here and I'll investigate further. It will look something like this: Error exporting photo DSC03584.dng (D05A5FE3-15FB-49A1-A15D-AB3DA6F8B068.dng) as DSC03584.dng: Could not create CIImage for /Users/rhet/Pictures/Test-10.15.7.photoslibrary/originals/D/D05A5FE3-15FB-49A1-A15D-AB3DA6F8B068.dng |
So I have figured out the issue. The issue is that for some reason for a number of images that were taken as RAW DNG, there is an additional FullSizeRender.jpg available. I think this might have been generated by some software, but I cannot find enough data in the exif to figure that out. This file is stored as a raw TIFF. Not sure how Photos allows that, but it is clear it is there. So osxphotos is exporting this FullSizeRender.jpg as a .jpeg file - but without actually doing the conversion. I guess because you assume that if the extension is .jpg then it is already in JPEG format. But it seems that this is a case where there is a TIFF stored with jpg extension. Another minor issue - for some reason if there are files that are already .jpg - then the output is with extension .jpg. For DNG and HEIC the output is with extension .jpeg. Is this intentional? |
This is strange as osxphotos doesn't export the FullSizeRender.jpg files. Can you post the path to the FullSizeRender.jpg within your library? Have the DNG files in question been edited? If so, as you are exporting If you can get the UUID of one of the DNG files in question, I can walk you through some additional debugging commands in osxphotos that would provide helpful data. There's an applescript in the osxphotos repo that you can run to get the UUID. Select the photo in Photos then run the applescript and a pop-up dialog will show some info about the photo. The UUID is a 36-character string that looks similar to this: On the subject on JPG vs jpeg, yes, this is known and it's annoying but it's due to macOS behavior--other users have found this annoying as well. Here's how osxphotos handles those:
I have thought about adding a |
The DNG has been edited. There is a render available and the render is actually a TIFF file with jpeg extension. Not sure why this was written this way and by what app. Since I made this edit some time ago I don't have the memory of what app did this. The AppleScript returns - D66A6077-B847-448A-8939-DEA12F070019/L0/001, IMG_1379.HEIC, missing value, missing value, missing value In this case this is a HEIC original with a TIFF in jpeg render. And it is output as TIFF in jpeg and obviously exiftool dies on this file as well. The edits were done on iPhone and synced over iCloud. On the iPhone this shows up as FullSizeRender.jpg whereas on the Mac this is named as D66A6077-B847-448A-8939-DEA12F070019_1_201_a.jpeg. In both cases this is actually a TIFF file but somehow saved with jpeg extension. So not sure what is the right way to handle this by osxphotos. Are you actually doing the conversion to jpeg or are you asking photos to do the conversion? When I do the export from Photos it does output this as jpeg correctly. |
OK, this is helpful. Here's what I think is going on: however this was edited on the iPhone is creating a TIFF but named as a .jpeg as you've noted. Because you are exporting with --skip-original-if-edited and --convert-to-jpeg, osxphotos sees that the image has been edited, sees the jpeg file and so exports that but does not convert it because it already appears to be a jpeg. However, when running exiftool, exiftool does generate an error, because it's not a jpeg, and osxphotos reports this. On conversion -- osxphotos does the conversion using macOS native CoreImage system calls so any image that Photos can convert, osxphotos should be able to. But in this example, I don't think that's ever getting called as the file appears to be a jpeg to osxphotos. Try the following: |
Got the debug dump -- thanks. Interesting observations from the data:
However, #3 is incorrect as you've noted the edited files are really TIFF files. But because of #3, osxphotos also thinks this is a jpeg and thus doesn't attempt to convert it and exiftool thus fails. I don't think this is a problem osxphotos can solve as looking at every single file to determine what type it is (to verify it's really a jpeg) would be very slow and difficult to get 100% right. I've noticed that the Photos assigns the UTI for the image based on file extension when importing, even if this is incorrect. Photos however displays the image with no problem. The code in Photos that displays must look at image header to determine type and this is independent of the database code that tracks metadata. So it's expected that Photos would display your image with no problem even though it's really a TIFF. I think this is a bug in either "luminar flex" or Photos. Much more likely it's in luminar. My guess is the issue is that luminar is writing TIFF data in their Photos plugin but the Photos editing extension protocol expects JPEG. From Apple's Photo Extension documentation:
If luminar is an important part of your workflow, I suggest you contact the developer to look into this. You can verify if this is the issue for the other photos causing the same error by doing the same debug-dump command for each UUID and looking for |
Thanks for digging through this. I am going to manually convert all the images to jpeg and rewrite and will file a bug with Luminar. |
I have some DNG RAW files in my library and when using --convert-to-jpeg --exiftool, I found errors in the logs - photo_181016_4116163723_edited.jpeg: Error: Not a valid JPEG (looks more like a TIFF)
And looking at the file it looks like for some reason osxphotos outputted TIFFs with jpeg extensions. Files are all around 70MB is size. Any ideas why?
The text was updated successfully, but these errors were encountered: