Write value to DR4 CropInfo

Started by rickychan, April 13, 2024, 09:27:11 PM

Previous topic - Next topic

rickychan

I have a cr2 file with both VRD and DR4 Recipe data, how can I write the value to the DR4 CropInfo?

I would like to copy the crop information in VRD to DR4

ricky

StarGeek

Use the command in FAQ #3 to figure out the name of the tag you want to write to.  Or check the CanonVRD Tag Page.

Once you figure out the name of the tag, the basic command is
exiftool -TAG1=Value -TAG2=Value /path/to/files/

Replace the TAG# with the tag you want to write and /path/to/files/ with the file and/or directory paths containing the files you want edited.

And please use standard text characters. It makes it easier to find you post if someone in the future is searching with a similar question.
* 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).

rickychan

#2
Hi StarGeek,

Thanks for your information, I tried to used this command to change the CropInfo

exiftool -CanonDR4:CropX=0 -CanonDR4:CropY=0 -CanonDR4:CropWidth=300 -CanonDR4:CropHeight=300 test1.cr2

but I found the CropY value is not correct in DPP 4

dpp4_crop.jpg

After update the file, I used the below command to check the tags and it seems ok

exiftool -CanonDR4:Crop* test1.cr2
Crop Aspect Ratio Custom        : 1 1.5
Crop Rotated Original Width     : 1288
Crop Rotated Original Height    : 1936
Crop X                          : 0
Crop Y                          : 0
Crop Rotation                   : 0
Crop Original Width             : 1936
Crop Original Height            : 1288



StarGeek

Do you have a sample CR2 file that has CanonDR4 data that you can share?  And what is DPP 4? A google search only pulls up Dipeptidyl peptidase 4 (DPP-4) inhibitors.
* 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).

rickychan

#4
Hi StarGeek,

The DPP stands for Digital Photo Professional, which is a Canon photo editor for cr2 raw image, you can search canon dpp for download. If you need the camera serial no, you can try this 0430104251

Attach is the cr2 sample file, I used the below command to change the CropInfo

exiftool -CanonDR4:CropX=0 -CanonDR4:CropY=0 -CanonDR4:CropWidth=300 -CanonDR4:CropHeight=300 -CanonDR4:CropAspectRatio="1:1" -CanonDR4:CropRotation=0 -CanonDR4:CropOriginalWidth=1936 -CanonDR4:CropOriginalHeight=1288 -CanonDR4:CropRotatedOriginalWidth=1288 -CanonDR4:CropRotatedOriginalHeight=1936 test1.cr2

I suppose the crop rectangle should be at the left-top when you open the updated cr2 using DPP4, but it doesn't

rickychan

It seems the CropRotation in CropInfo Tags is not correct, the type should be int32s and the index should be 7, index 8 and 9 should fill with 0

StarGeek

There's not much I can help with since I don't have the program.  You'll have to test things out.  Make sure you're looking at the data with the command in FAQ #3 as I noticed there are duplicated tag names between the Canon, CanonDR4, and CanonVRD groups. You want to make sure you are testing each group separately.
* 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).

Phil Harvey

Try doing the crop in DPP and see what ExifTool reports back.  I just tried this this with DPP 4.18.10.0, and CropRotation is definitely correct -- it is a double-precision IEEE value at offset 8.

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

rickychan

Hi Phil,

You are right, the CropRotation is at offset 8 and 9 using double. But the offset 7 can not be undefined. For my case, my testing photo is in portrait orientation, I need to change the value at offset 7 to 270 to have a correct crop in DPP4. Can you please help to confirm it.

Phil Harvey

I'll just go ahead and add "CropRotation" at offset 7 and change the tag at offset 8 to be named "CropAngle".

Do you have any idea what the value at offset 12 is for?  It is a double-precision number with value 100 in my sample.

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

rickychan

Hi Phil,

Thanks for your support, your tools is great.

I will try to check the usage of offset 12 later and post any findings here.

One more question about the output file. I know some unused 0 will be removed in the output file, but is there any option we can keep those unused 0? My idea is can we keep the output binary structure as close as the input file possible. It is more easy to check which byte have been changed by exiftool.

Phil Harvey

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

blue-j

rickychan

Quote from: Phil Harvey on April 18, 2024, 07:16:27 AMDo you have any idea what the value at offset 12 is for?  It is a double-precision number with value 100 in my sample.