Change Rotation/orientation for old Minolta files

Started by RobiWan, July 06, 2018, 01:49:28 AM

Previous topic - Next topic

RobiWan

Hi,

The old Minolta RAW files have incorrect orientation when recorded vertically.
I tried the following but unfortunately had no luck.

exiftool -if "$Rotation eq 'Rotate 270 CW'" "-IFD0:Orientation='Rotate 270 CW'" pict4118.mrw -overwrite_original
Warning: Can't convert IFD0:Orientation (not in PrintConv)
Nothing to do.



StarGeek

Remove the single quotes in the assignment part.  You're trying to assign the value of 'Rotate 270 CW' (single quotes included) which isn't an option.  Use just Rotate 270 CW.  You can assign with either "-IFD0:Orientation=Rotate 270 CW" or -IFD0:Orientation="Rotate 270 CW" or even use the raw value with the addition of the hash tag, no quotes needed at all in that case -IFD0:Orientation#=8.
* Did you read FAQ #3 and use the command listed there?
* Please use the Code button for exiftool code/output.
 
* Please include your OS, Exiftool version, and type of file you're processing (MP4, JPG, etc).

RobiWan

Thank you so much.
However, that is not all. From the looks of things, I've got to make some changes. If "Rotate 270 CW" is found in the RAW file, "-tiff:Orientation=8" should be written to XMP file

I try this but no luck again.
(Its part of my powershell code)

exiftool -if "`$Rotation eq 'Rotate 270 CW'" "`"$element`"" "-tiff:Orientation=8" "`"$element1`"" "-FileCreateDate<DateTimeOriginal" "-FileModifyDate<DateTimeOriginal" -overwrite_original

where $element is RAW file and element1 XMP file

Phil Harvey

XMP-tiff:Orientation is written the same way as EXIF:Orientation.  As StarGeek described.

If you just write "Orientation", then ExifTool will write the correct one to each file type.

- Phil
...where DIR is the name of a directory/folder containing the images.  On Mac/Linux, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).

RobiWan

That doesn't seem to be working. I'll try to describe it differently.

exiftool -if "`$Rotation eq 'Rotate 270 CW'" RAWFile "-IFD0:Orientation=Rotate 270 CW" RAWFile "-XMP-tiff:Orientation=8" XMPFile -overwrite_original

If "Rotate 270 CW" tag is found in the RAW file, then write -IFD0:Orientation=Rotate 270 CW into RAW file AND -XMP-tiff:Orientation=8 into XMP file (because XMP file always exist here).
I hope now it is more understandable what I want to achieve

StarGeek

Quote from: RobiWan on July 06, 2018, 02:01:46 PM
If "Rotate 270 CW" tag is found in the RAW file, then write -IFD0:Orientation=Rotate 270 CW into RAW file AND -XMP-tiff:Orientation=8 into XMP file (because XMP file always exist here).

I think you have to run two separate commands or use the -execute and -Common_Args options.  From this previous post, Phil says

Quote from: Phil Harvey on June 01, 2017, 07:16:09 AMAnd when writing, you must write the tags you want to each of the files separately.

Also, you don't want to write -XMP-tiff:Orientation=8.  You want to, as I said, add the hashtag to write a raw value.  With -XMP-tiff:Orientation=8, exiftool will match that to "Rotate 180", as that is the only option for Orientation that contains an 8, (see FAQ #6, third paragraph).  What you want to write for the raw value would be -XMP-tiff:Orientation#=8 or use the plain text version -XMP-tiff:Orientation="Rotate 270 CW"
* Did you read FAQ #3 and use the command listed there?
* Please use the Code button for exiftool code/output.
 
* Please include your OS, Exiftool version, and type of file you're processing (MP4, JPG, etc).

RobiWan

#6
Quote from: StarGeek on July 06, 2018, 03:21:09 PM
Also, you don't want to write -XMP-tiff:Orientation=8.

I don't think that's so important. It is important that it is written to different files, because unfortunately all XMP files have the TAG Orientation=1
I will check what I can do with execute

[EDIT]
I think I don't understand how -execute command works.

exiftool -if "`$Rotation eq 'Rotate 270 CW'" RAWFile -execute "-XMP-tiff:Orientation=Rotate 270 CW" XMPFile "-overwrite_original"
don't work correctly because all XMPFiles are modified not only files who the if condition is true for given RAWFile
[/EDIT]

StarGeek

#7
Ok, it took some digging but I think I got it.  The -if condition is only applies to the file being processed.  To copy a tag based upon the condition of a different file is covered by note #4 under the -if option.  It requires two steps.  First making a list of files that match the condition and then using that to actually process the files.

This may require some work and probably Phil needs to look it over.  I haven't tested it.  Edit as needed.

So, first set the tags on the original RAW file
exiftool -if "$Rotation eq 'Rotate 270 CW'" "-IFD0:Orientation=Rotate 270 CW" "-XMP-tiff:Orientation=Rotate 270 CW" -overwrite_original RAWFile

Then get list of these files and save to a temp file
exiftool -if "$Rotation eq 'Rotate 270 CW'" -ext mrw -p "$directory/$filename" DIR > Temp.txt

Then use the temp file as input (the -@ option)
exiftool -@ Temp.txt -srcfile %d%f.xmp "-XMP-tiff:Orientation=Rotate 270 CW"

Some further reading on this can be seen in this thread.

Edit: Fixed quoting
* Did you read FAQ #3 and use the command listed there?
* Please use the Code button for exiftool code/output.
 
* Please include your OS, Exiftool version, and type of file you're processing (MP4, JPG, etc).

RobiWan

How does your Test.txt file look like? The file contains all metadata that exiftool has read.

======== i:/MRW/pict4117.mrw
ExifTool Version Number         : 11.06
File Name                       : pict4117.mrw
Directory                       : i:/MRW
File Size                       : 8.8 MB
File Modification Date/Time     : 2011:05:14 13:13:44+02:00
File Access Date/Time           : 2018:07:07 14:24:06+02:00
File Creation Date/Time         : 2011:05:14 13:13:44+02:00
File Permissions                : rw-rw-rw-
File Type                       : MRW
File Type Extension             : mrw
MIME Type                       : image/x-minolta-mrw
Firmware ID                     : 21810002
Sensor Height                   : 2008
Sensor Width                    : 3016
Image Height                    : 2000
Image Width                     : 3008
Raw Depth                       : 12
Bit Depth                       : 12
Storage Method                  : Linear
Bayer Pattern                   : RGGB
WB Scale                        : 2 2 2 2
WB RGGB Levels                  : 391 256 256 467
Saturation                      : 1
Contrast                        : 1
Sharpness                       : 2
WB Mode                         : Auto (0)
Program Mode                    : None
ISO Setting                     : 400
Color Mode                      : Embed Adobe RGB
Color Filter                    : 1
...
....

StarGeek

Sorry, my mistake.  I didn't fix the quoting when I was copy/pasting.  I edited my post and it should be correct now.
* Did you read FAQ #3 and use the command listed there?
* Please use the Code button for exiftool code/output.
 
* Please include your OS, Exiftool version, and type of file you're processing (MP4, JPG, etc).

RobiWan

I'm sorry but this doesn't work - see my previous post

There are some things at Exiftool that I can't understand - at least under Windows
1. the text file does not only have file names
2. "-FileCreateDate<DateTimeOriginal" "-FileModifyDate<DateTimeOriginal" no longer works for XMP files


StarGeek

What is the complete and exact command you are using and the complete output?

I had to change Rotation into Orientation as I don't have a file with a Rotation tag, as well as remove the -ext mrw as I don't have any mrw files,  but second command worked for me.

c:\>exiftool -if "$orientation eq 'Rotate 270 CW'"   -p "$directory/$filename" y:\!temp\  >Temp.txt
    1 directories scanned
   82 files failed condition
    8 image files read

c:\>type temp.txt
y:/!temp/Esmée.jpg
y:/!temp/MPO.mpo
y:/!temp/sony_a7r_ii_zeiss_batis_25mm_02.arw
y:/!temp/Test_DNG.dng
y:/!temp/Test_Nef.NEF
y:/!temp/Test_Tiff.tif
y:/!temp/xyzzy.jpg
y:/!temp/Test3.jpg
* Did you read FAQ #3 and use the command listed there?
* Please use the Code button for exiftool code/output.
 
* Please include your OS, Exiftool version, and type of file you're processing (MP4, JPG, etc).

RobiWan

Hi,

Quote from: StarGeek on July 07, 2018, 01:57:33 PM
What is the complete and exact command you are using and the complete output?

all works now perfect. Wrong quoting and one parameter.
Thank you  ;D