Editing multiple value tags

Started by bogdan, July 16, 2014, 03:25:13 AM

Previous topic - Next topic

bogdan

Hello,

I am having problems figuring out the command line syntax to change tags that have multiple values (tag count is > 1)

Say I have a DNG file for which:

exiftool.exe  -a -G1 -s rotated.dng

reports

[SubIFD]        DefaultCropSize                 : 1280 720


and I want to change it to:

[SubIFD]        DefaultCropSize                 : 720 1280


This sounds like a basic task, but still I wasn't able to find any example/documentation how to do it.

Here's what I thought would work, but didn't:


exiftool.exe -SubIFD:DefaultCropSize=720 -SubIFD:DefaultCropSize+=1280 rotated.dng
Warning: Not enough values specified (2 required) for SubIFD:DefaultCropSize
Warning: Can't shift DefaultCropSize (not a number) - rotated.dng
    0 image files updated
    1 image files unchanged

exiftool.exe -sep "_" -SubIFD:DefaultCropSize=720_1280 rotated.dng
Warning: Not enough values specified (2 required) for SubIFD:DefaultCropSize
Nothing to do.

exiftool.exe -SubIFD:DefaultCropSize=720 -SubIFD:DefaultCropSize=1280 rotated.dng
Warning: Not enough values specified (2 required) for SubIFD:DefaultCropSize
Warning: Not enough values specified (2 required) for SubIFD:DefaultCropSize
Nothing to do.


Thank you for an amazing tool!

Hayo Baan

Hi Bogdan,

You simply need to provide the two values as one string:
exiftool -DefaultCropSize="720 1280" rotated.dng
But there's an even better method that doesn't require you to type the values:
exiftool "-DefaultCropSize<${DefaultCropSize;s/(\d+) (\d+)/$2 $1/}" rotated.dng
(on a mac, use single quotes)

Hope this helps,
Hayo
Hayo Baan – Photography
Web: www.hayobaan.nl

bogdan

Thanks, it worked like a charm.

PS: I wonder why I haven't been able to dig this out from the documentation...