-
exiv2 0.27.5 on Windows 11 I'm new to exiv2 and not intimately familiar with exif (beyond reading the values) so I'm not sure exactly what to ask nor what else I'm doing wrong. I'm trying to copy tags from one file to another (a CR3 to a jpg in this case) because RawTherapee doesn't yet fully handle CR3 metadata. I'm doing this, which I read at https://dev.exiv2.org/boards/3/topics/2329 :
That does copy the tags, but it also changes (per XnView at least) the orientation value from 1 to 8. Indeed, the JPG gets rotated 90 degrees CCW. FastStone shows it rotated and opening it in GIMP I'm prompted whether to rotate or not. However, exiv2 apparently doesn't see any difference between the two files:
I've not yet fully gotten my head around the exiv syntax so experimentation hasn't gotten me too far. Can someone explain what's happening, how I can fix this and / or if there's a better way to copy tags? I don't want to modify them, I just want populate the tags RawTherapee is skipping. Thanks! |
Beta Was this translation helpful? Give feedback.
Replies: 10 comments 5 replies
-
I think you've got your head around the command-line program. It's a bit of swiss army knife, however you've got the basic idea. Piping the metadata is probably more "advanced" than you need yet. Additionally, I think a bug was reported and fixed concerning the piping code. So, let's focus on using "simple" commands. The most basic commands are: 1 Reading metadata value
This says "The tag for Orientation is 0x0112 in the Tiff Specification, and is an array with one 16-bit integer which as a value of 1". It's more common to print the "translated values" (translated = interpreted for human use)
The output is similar, however instead of showing the value of "1", it is "translated" to the string "top, left".
@postscript-dev has done very good work on the documentation on the 'main' branch and I highly recommend that you read that. The Please be aware that applications which display images on your computer might not understand the Orientation tag. I am happy to meet with you on Zoom to chat about the exiv2 command-line utility. |
Beta Was this translation helpful? Give feedback.
-
(Apologies in advance for the long post) Thank you very much for the prompt, detailed reply and for the generous Zoom offer! At this point, I'm mainly trying to devise a method that will reliably just copy tags from one file to another. As mentioned, RawTherapee (which I use from time to time) doesn't yet handle CR3 metadata, so in order to have EXIF in my processed images I need to manually copy it from the raw file. Also, I've had occasional instances where GIMP doesn't write EXIF to exported images. On my previous computer (Xubuntu 20.04) I wrote a script that used ExifTool to batch process images but it was suggested exiv2 might be a better option, hence my research here. However I'm confused what's actually going on here ...no surprise there! :-) Data points, FWIW... Prior to copying tags:
i.e., no EXIF in the JPG. After copying tags with the above exiv2 command syntax:
But in almost every app I view the JPG, it's rotated 270 degrees. And you're right, there can certainly be differences / errors in how apps interpret tags. For example: XnView
Indeed, the shot was taken in portrait orientation but I'm 99% sure it was with the camera rotated 270 counter/anti-clockwise, not clockwise. Maybe whatever ExifTool is reading as "Rotate 270 clockwise" is being interpreted by others to incorrectly rotate it yet again? [ Update - Duhh... same thing: left 90 vs right 270. It's a slow Sunday afternoon, obviously! :-) ] FastStone Image Viewer
GIMP
RawTherapee
darktable
So what's happening? I can't tell. I can attach the files pre- or post-copy, if desired. It may be an edge case, but I'd like to handle edge cases properly. At this point I'm more interested in getting the copy process correct and will deal with individual image issues if / when they arise. Can you point me to a proper, reliable syntax? Or are the steps you outlined above as concise as it currently gets? Thanks! |
Beta Was this translation helpful? Give feedback.
-
I've just thought of something totally different. My camera (a Nikon D5300) has a setting "Auto Image Rotation" ON/OFF. It's set to "ON". What does it do? The User Manual doesn't say. I suspect it concerns the preview display on the back of the camera. It's possible to have "portrait" photos with Orientation = 1 by writing the image with more rows of shorter length. I believe my camera always writes the image with more pixels/rows and uses the information from the rotation sensor to determine Exif.Image.Orientation However, there it's possible for the camera to use the information from the rotation sensor to determine how the image is to be written. And there's a third possibility. Your camera doesn't have a rotation sensor. |
Beta Was this translation helpful? Give feedback.
-
The @clanmills is correct that there are a small number of bugs in the I would make one small change to your command line though as when printing non built-in $ exiv2 -PkyV filename.CR3 | exiv2 -m- filename.jpg This bug has been fixed in the As for the individual applications, @clanmills has come up with some good suggestions but it is difficult to investigate more without a test image. |
Beta Was this translation helpful? Give feedback.
-
Another interesting discovery. "Auto Image Rotation" ON/OFF on the D5300 causes the image to be written "side-ways" with Exif.Image.Orientation = 1. ACDSee correctly displays the image "on its side". I fixed it with the command: $ exiv2 -M'set Exif.Image.Orientation 8' dsc_0003.jpg I was little disappointed that ACDSee doesn't monitor the FileSystem and update the UI when the file was modified. However leaving and re-entering the folder worked perfectly. |
Beta Was this translation helpful? Give feedback.
-
I mentioned them only because they (and exiv2, exiftool) provide me visibility into EXIF data.
I downloaded a Windows binary (exiv2-0.27.5-2019msvc64.zip) from exiv2.org, I believe. Until two months ago I ran Linux at home (for ~6 years) but my new laptop has Windows 11 on it so I'm getting re-familiar with Windows again. I've not yet set up a dev/build environment on it.
I don't need to change it. As indicated, I mentioned darktable simply as one of several auxiliary references / test cases. The apparent change in target-image orientation when viewed in the other apps is what triggered my questions here. My intent is to simply populate a few tags if missing in an image -- Typically due to RawTherapee not yet fully supporting CR3 metadata or whatever occasionally happens in GIMP.
I have a Canon T8i (850D). I've not found it documented anywhere but it appears to detect orientation changes. I shot a series of four images at 90 degree intervals: portrait, rotated 90CW, inverted, rotated 270 CW. All display correctly, all are full size (not truncated), etc. Both exiv2 and exiftool show they've been rotated: exiv2
exiftool
I'm in the southern US (Louisiana), Central Time zone. As I mentioned before I appreciate your Zoom offer but I think that's overkill for me at the moment. I'm not a developer (I wish had been, instead of a sysadmin!) and at present, not even up to speed on how tags are interpreted, etc. I'm just trying to work around a bug or two. I'm afraid I'd be way out of my depth in such a conversation and would be able to contribute nothing of value. Plus, the last thing I want is to potentially waste anyone's time on a 'wild goose chase'. Other than what I mentioned about RT and GIMP, I have no reason to suspect misbehavior from any app (nor my camera) at this point. Thanks again for all the info. Thank you for the info and recommendations. I'll take a look ASAP -- kinda tied up at the moment. I don't mind posting a test image if it comes to that, but I think first I need to do my homework and make sure I'm using exiv2 correctly. |
Beta Was this translation helpful? Give feedback.
-
It's never a "wild goose chase" to help a user. I consider User Support and Security to be my top priorities for Exiv2. Peter (@postscript-dev) and I are always happy to help. Being retired, I have more time. You have a very good camera which has a rotation sensor. You've proven that with the metadata from ExifTool and Exiv2. I think every Canon has a rotation sensor. I have a little point-n-shoot Canon IXUS-185 ($99) which has a rotation sensor. However, maybe playing with the apps and the exiv2 commands that you really understand will bring you to "enlightenment" and give you the confidence to work with other tags.
Setting up a developer environment on Windows? WSL (Windows Subsystem for Linux) is Linux! (not kidding, it is linux). Cygwin and MinGW feel very much like Linux. The "native" Windows Development environment is Visual Studio and M/S provide a free Community Edition. If you are familiar with GCC and the Linux tools, use WSL. Visual Studio is really good, however it will feel very different from Linux. Louisiana? Been in New Orleans and all 50 States. Proud to be a US Citizen. Just as proud to be Scottish and retired in England. https://clanmills.com/2005/SouthernTrip/Homepage/ Good Luck. |
Beta Was this translation helpful? Give feedback.
-
Yep, I've got WSL installed (Ubuntu) as well as Linux Mint running in a VirtualBox VM. But I was thinking about a native Windows build env. Years ago I bought Visual C++ 2003. I've also tried Code::Blocks / MinGW. 20+ years ago I played with C, VB, Perl, QuickBASIC, etc. at a hobbyist level. Never came to terms with C++ and OOP, but I really found C interesting (still do). However I've not thought about it for many years (and "use it or lose it" is most definitely true). Since then I did some Bash scripting as part of my unix admin job, but on the Windows side I haven't really learned too much about PowerShell just yet (it's definitely from MS, no doubt). :-) So you saw NOLA only a few months before Katrina hit. I'm about 200 miles to the NE, in the center of the state. I'm probably not the most enthusiastic flag-waver for 'all things Louisiana', but I'll admit they've got that food thing nailed... Thanks. |
Beta Was this translation helpful? Give feedback.
-
Yes. We watched Katrina from San Jose, CA. Because of our visit, we understood the geography. Natchez Trace Parkway is on our "bucket list" along with Selma, AL. A visit to family in Houston, TX might be followed a trip near you. When we visited the Jefferson Davis Library in Biloxi, I took a photo of the death mask. A few years later I got an email from Rice University requesting the hi-res original. Post Katrina, nobody knew where the death mask had been stored. They wanted a photo for a book they were publishing: https://jeffersondavis.rice.edu I've never learnt PowerShell, however I know and use bash a lot. Python is my favourite scripting language and the Exiv2 test suite is now 100% Python. One of the reasons I worked on Exiv2 since retiring is to retain my C++ and cross-platform skills. The other reason is the team of great people who work with me on Exiv2. I'm finally on my way "out the door" on Exiv2. The Team deal with the tough stuff. |
Beta Was this translation helpful? Give feedback.
-
Hopefully you are aware of the excellent exif orientation sample files at:
https://github.com/recurser/exif-orientation-examples
as well as the detailed blog about the subject at:
https://www.daveperrett.com/articles/2012/07/28/exif-orientation-handling-is-a-ghetto/
…On Mon, Mar 28, 2022 at 11:58 AM Robin Mills ***@***.***> wrote:
It's never a "wild goose chase" to help a user. I consider User Support
and Security to be my top priorities for Exiv2. Peter ***@***.***
<https://github.com/postscript-dev>) and I are always happy to help.
Being retired, I have more time.
You have a very good camera which has a rotation sensor. You've proven
that with the metadata from ExifTool and Exiv2. I think every Canon has a
rotation sensor. I have a little point-n-shoot Canon IXUS-185 ($99) which
has a rotation sensor.
However, maybe playing with the apps and the exiv2 commands that you
really understand will bring you to "enlightenment" and give you the
confidence to work with other tags.
$ exiv2 -pv --grep Orientation path
$ exiv2 -M'set Exif.Image.Orientation 6' path
Setting up a developer environment on Windows? WSL (Windows Subsystem for
Linux) is Linux! (not kidding, it is linux). Cygwin and MinGW feel very
much like Linux. The "native" Windows Development environment is Visual
Studio and M/S provide a free Community Edition. If you are familiar with
GCC and the Linux tools, use WSL. Visual Studio is really good, however it
will feel very different from Linux.
Louisiana? Been in New Orleans and all 50 States. Proud to be a US
Citizen. Just as proud to be Scottish and retired in England.
https://clanmills.com/2005/SouthernTrip/Homepage/
Good Luck.
—
Reply to this email directly, view it on GitHub
<#2168 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ACFCLPG2THTEEQENCCP6QY3VCH6NPANCNFSM5RYDSCQA>
.
You are receiving this because you are subscribed to this thread.Message
ID: ***@***.***>
|
Beta Was this translation helpful? Give feedback.
It's never a "wild goose chase" to help a user. I consider User Support and Security to be my top priorities for Exiv2. Peter (@postscript-dev) and I are always happy to help. Being retired, I have more time.
You have a very good camera which has a rotation sensor. You've proven that with the metadata from ExifTool and Exiv2. I think every Canon has a rotation sensor. I have a little point-n-shoot Canon IXUS-185 ($99) which has a rotation sensor.
However, maybe playing with the apps and the exiv2 commands that you really understand will bring you to "enlightenment" and give you the confidence to work with other tags.