Use exiftool to modify OpCodeList

Started by ibtesam101, January 20, 2020, 04:57:24 AM

Previous topic - Next topic

ibtesam101

Hi,

I want to modify only part of the opcodelist3 tag. Is that possible with the exiftool?

Currently, I'm able to strip away the entire opcodelist3 by using the following command


exiftool PathToFile -opcodelist3=


On printing the opcodelist3, I have GainMap and WarpRectilinear operations applied on a DNG image.

exiftool PathToFile -opcodelist3

Output: Opcode List 3                   : GainMap, WarpRectilinear

Q1: Is it possible to remove only one of the operations instead of all of them (i.e. only strip away GainMap or only strip away WarpRectilinear)? I was able to modify other values on other tags such as Focal Length, but I can't seem to get access to the operations of opcodelist3. If it's possible with exiftool, what would the command look like?

Q2: WarpRectilinear applies chromatic aberration and distortion. Is it possible to modify only the distortion[remove it] and keep chromatic aberration (or vice versa) using exiftool? If so, what kind of command would that look like?

Furthermore, if anyone has any clues on how to do these things, I'd appreciate that as well. :)

Thank you.

StarGeek

Quote from: ibtesam101 on January 20, 2020, 04:57:24 AM
Q1: Is it possible to remove only one of the operations instead of all of them (i.e. only strip away GainMap or only strip away WarpRectilinear)?

Hmm...  I'm not sure.  I don't have a sample that has OpcodeList3 set and my attempts to create it fail.  Looking back through the forum, any OpcodeList# tag is mentioned in only 4 posts and all of those show it as holding binary data only, ranging from a few hundred bytes to 75kbytes.

Looking at the Exif tag page, it shows that OpcodeList3 is undefined as to what values it can hold as well as being marked as unsafe for editing.

What is the output of this command on your file?
exiftool -g1 -a -s -OpcodeList3# FILE

This probably requires Phil's attention, but he is away until the end of the week.  It may be that this is not a simple tag to edit.

QuoteQ2: WarpRectilinear applies chromatic aberration and distortion. Is it possible to modify only the distortion[remove it] and keep chromatic aberration (or vice versa) using exiftool?

This sounds like a function of the program you're using to render the image. 

You probably have to wait until Phil gets back for further details.
* 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).

ibtesam101

Thanks for the reply.

I tried out the command
exiftool -g1 -a -s -OpcodeList3# FILE

The output was:
---- SubIFD ----
OpcodeList3                     : (Binary data 12564 bytes, use -b option to extract)


You can download the sample from here:
https://drive.google.com/file/d/1AqbrWSIfEwNmMMxr0V0JnXd0jxIafAIf/view?usp=sharing

:)

StarGeek

Yeah, 12k of binary data isn't something that's like changing a date/time.  I did a bit of searching and found Adobe's PDF on the DNG specs.  It describes the opcodes on page 83 and it looks like some serious equations involved. 

I can't find anything online about editing this data.

You'll have to wait a few more days for Phil to return and comment.
* 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

ExifTool doesn't support detailed editing of the OpcodeList.  I don't know if it makes sense to add this feature because this is verging on image editing.  Plus, this may be a difficult feature to implement, and you are probably the only one that would ever use it.

- 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 ($).

ibtesam101

Oh, that makes sense.


Thanks regardless. :D

scaron

Hey Gang,

Just some context here as I am working with ibtesam101 on finding a solution to modifying the OpcodeList.

Some files have vendor embedded profiles, in this case the DJI raw file is a DNG and it embeds those two operations for Lightroom (in this case) to do when loading the image. The problem is you can't turn this OFF. So yes, this is ultimately an issue with Adobe and we should probably contact them. But after years of others begging for control over this Adobe has done no such thing (I hope I am wrong).

https://community.adobe.com/t5/camera-raw/removing-embedded-profile-in-dng-file/td-p/8984032

So we needed to find a different solution. I figured since exiftool could dump the data to file that maybe we could provide an input dat file for it to set the data from.

I am leaning on now building a .lcp file (lens profile) of the Mavic 2 Pro, stripping the metadata, and getting Lightroom to load the .lcp to do the corrections we need. I hope this can help others in the future that might ask the same question. And if this topic is ever revisited you will have context from a use case.

Thanks Phil!


Phil Harvey

If you can generate a binary opcodelist file, or copy one from a file with an opcodelist that you want, then you can use ExifTool to write this to another file.

- 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 ($).

wu

Quote from: Phil Harvey on January 27, 2020, 09:12:21 PMIf you can generate a binary opcodelist file, or copy one from a file with an opcodelist that you want, then you can use ExifTool to write this to another file.

- Phil
How can I write a binary opcodelist file to another file?

StarGeek

#9
You would use
exiftool -TagsFromFile Source.dng -OpcodeList1 -OpcodeList2 -OpcodeList3 Target.dng

This assumes that all three OpcodeList tags exist.

fixed command
* 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

(oops, forgot the dash on -OpcodeList2)
...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 ($).

ETUser

so I have 2 DNG files

one has OpcodeList3 (source.DNG) and one does not (target.DNG)

I try to copy the whole OpcodeList3 and

exiftool -TagsFromFile source.DNG -OpcodeList3 target.DNG -overwrite_original

the output is

Warning: [Minor] Not decoding some large array(s). Ignore minor errors to decode - source.DNG
Warning: No writable tags set from source.DNG
0 image files updated
1 image files unchanged

and nothing is copied

what might be the reason ?!

Phil Harvey

If you check the EXIF tag documentation, you'll see this tag is writable only with the -n option.

Oct. 16, 2019 - Version 11.71
  - Added a simple print conversion for DNG OpcodeList tags (note that due to
    this, these tags must now be copied using the -n option)


- 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 ($).

ETUser

yes, already found about -n , you answered sooner than I got back here to report it myself, thank you !!!