ExifTool Forum

ExifTool => The "exiftool" Application => Topic started by: ibtesam101 on January 20, 2020, 04:57:24 AM

Title: Use exiftool to modify OpCodeList
Post by: ibtesam101 on January 20, 2020, 04:57:24 AM
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.
Title: Re: Use exiftool to modify OpCodeList
Post by: StarGeek on January 20, 2020, 12:16:19 PM
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 (https://exiftool.org/TagNames/EXIF.html), 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.
Title: Re: Use exiftool to modify OpCodeList
Post by: ibtesam101 on January 21, 2020, 01:58:45 AM
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

:)
Title: Re: Use exiftool to modify OpCodeList
Post by: StarGeek on January 21, 2020, 10:13:36 AM
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 (https://www.adobe.com/content/dam/acom/en/products/photoshop/pdfs/dng_spec_1.4.0.0.pdf#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.
Title: Re: Use exiftool to modify OpCodeList
Post by: Phil Harvey on January 24, 2020, 12:55:36 PM
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
Title: Re: Use exiftool to modify OpCodeList
Post by: ibtesam101 on January 27, 2020, 02:43:55 AM
Oh, that makes sense.


Thanks regardless. :D
Title: Re: Use exiftool to modify OpCodeList
Post by: scaron on January 27, 2020, 07:59:16 PM
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!

Title: Re: Use exiftool to modify OpCodeList
Post by: Phil Harvey on January 27, 2020, 09:12:21 PM
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
Title: Re: Use exiftool to modify OpCodeList
Post by: wu on August 16, 2022, 09:03:41 AM
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?
Title: Re: Use exiftool to modify OpCodeList
Post by: StarGeek on August 16, 2022, 01:35:25 PM
You would use
exiftool -TagsFromFile Source.dng -OpcodeList1 -OpcodeList2 -OpcodeList3 Target.dng

This assumes that all three OpcodeList tags exist.

fixed command
Title: Re: Use exiftool to modify OpCodeList
Post by: Phil Harvey on August 24, 2022, 03:54:23 PM
(oops, forgot the dash on -OpcodeList2)
Title: Re: Use exiftool to modify OpCodeList
Post by: ETUser on April 26, 2023, 08:33:39 PM
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 ?!
Title: Re: Use exiftool to modify OpCodeList
Post by: Phil Harvey on April 26, 2023, 08:48:23 PM
If you check the EXIF tag documentation (https://exiftool.org/TagNames/EXIF.html), 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
Title: Re: Use exiftool to modify OpCodeList
Post by: ETUser on April 26, 2023, 08:59:44 PM
yes, already found about -n , you answered sooner than I got back here to report it myself, thank you !!!