I'm trying to use exif on a command line to change the value of 2 tags in a DNG file.
I wish to change
CFA Pattern: [Red,Green][Green,Blue]
to
CFA Pattern: [Blue,Green][Green,Red]
and
CFA Pattern 2: 0 1 1 2
to
CFA Pattern 2: 2 1 1 0
I just can't figure out how to do this.. the closest I've come is to use:
exiftool -cfapattern=[Blue,Green][Green,Red] test.dng
when I do this, it comes back saying "1 image files updated"
but when I look at the updated file, it has not changed. I just can't figure out what I'm doing wrong... but I'm sure I must be using the wrong syntax.
Could someone please tell me the correct way to change these 2 tags?
If ExifTool says the file changed, then it did something. Add the -v2 option for more details about what it did.
I don't know what system you are running, but it would be safest to quote this argument in case the brackets or comma are special for the shell (the spaces in CFAPattern2 certainly would cause problems if not quoted):
exiftool -cfapattern="[Blue,Green][Green,Red]" -cfapattern2="2 1 1 0" test.dng
However, I think you may need to be more specific about where to write the tags. (Otherwise they will be written to the default group, see the EXIF tags documentation (https://exiftool.org/TagNames/EXIF.html) to see what group this is.) Use this command to see where they are stored:
exiftool "-cfapattern*" -G1 test.dng
And then write them to the same group, ie)
exiftool -SOME_GROUP:cfapattern="[Blue,Green][Green,Red]" -ANOTHER_GROUP:cfapattern2="2 1 1 0" test.dng
- Phil
Thank you very much, the command:
exiftool -exif:cfapattern2="2 1 1 0" test.dng
worked perfectly!
It looks like I don't need to change the other tag for what I'm trying to do, but I'm sure specifying the group and using quotes would make it work.
Thanks for the quick reply!
Is there some simple way I could change this tag on all DNG files in a particular folder and all folders under that folder as well?
First, I would specify a family 1 group (specific IFD) instead of just "EXIF", unless the CFAPattern2 is stored in the SubIFD (the default IFD for writing CFAPattern2).
Second, specify a directory name instead of a file name and add -ext dng to the command to process all DNG's in a directory. Add -r to also process sub-directories.
- Phil
Quote from: Phil Harvey on August 09, 2013, 10:25:25 PM
First, I would specify a family 1 group (specific IFD) instead of just "EXIF", unless the CFAPattern2 is stored in the SubIFD (the default IFD for writing CFAPattern2).
- Phil
I'm afraid you lost me there :-\ how can I find what family 1 group it is in? I'm a complete newbie at metadata... but it could explain why this is only working on my .dng's and not my original .arw files my goal here is to switch the red and blue data for infrared photographs while still keeping my raw data, so I'm trying to modify the color filter array pattern, and as I understand it, CFAPattern and CFAPattern2 are the tags that are concerned with this. Is there a way I can find out what the current family 1 group is? I've attached a screen shot showing the tag I'm trying to modify, it's about 28 down.
Thanks for the info on how to process an entire directory... I better make sure I'm doing it correctly before I go processing them all
Quote from: jls3512 on August 09, 2013, 11:11:59 PM
I'm afraid you lost me there :-\ how can I find what family 1 group it is in?
I explained this in my first post. The
-G1 option.
- Phil
Oh, I get it now...
Quote from: Phil Harvey on August 09, 2013, 06:50:03 PM
However, I think you may need to be more specific about where to write the tags. (Otherwise they will be written to the default group, see the EXIF tags documentation (https://exiftool.org/TagNames/EXIF.html) to see what group this is.)
on the above list the tags are listed as:
0x828e CFAPattern2 int8u[n]! SubIFD
0xa302 CFAPattern undef ExifIFD
Quote from: Phil Harvey on August 09, 2013, 06:50:03 PM
Use this command to see where they are stored:
exiftool "-cfapattern*" -G1 test.dng
when I use the above command I get:
[SubIFD] CFA Pattern 2 : 0 1 1 2
[Composite] CFA Pattern : [Blue,Green][Green,Red]
so just to make sure I'm doing this correctly,
should my command be:
exiftool -composite:cfapattern="[Blue,Green][Green,Red]" -subifd:cfapattern2="2 1 1 0" test.dng
or do the capital letters make a difference?
exiftool -Composite:CFAPattern="[Blue,Green][Green,Red]" -SubIFD:CFAPattern2="2 1 1 0" test.dng
the above gives me:
Ignored superfluous tag name or invalid option: -Composite:CFAPattern:[Red,Green][Green,Blue]
Thanks for the help with this.
Quote from: jls3512 on August 10, 2013, 09:40:22 AM
Oh, I get it now...
Excellent.
Quoteexiftool -composite:cfapattern="[Blue,Green][Green,Red]" -subifd:cfapattern2="2 1 1 0" test.dng
or do the capital letters make a difference?
Close. But you don't write this Composite tag directly. It is a convenience tag derived from the values of CFAPattern2 and CFARepeatPatternDim. See the Composite tags documentation (https://exiftool.org/TagNames/Composite.html) for details.
Case doesn't matter.
Quotethe above gives me:
Ignored superfluous tag name or invalid option: -Composite:CFAPattern:[Red,Green][Green,Blue]
Ooops. Your "=" has turned into a ":" somehow. I think you mis-typed your command. But it is likely that SubIFD:CFAPattern2 got written properly, so the command probably did what you wanted.
- Phil
Quote from: Phil Harvey on August 10, 2013, 09:59:40 AM
Quote from: jls3512 on August 10, 2013, 09:40:22 AM
Oh, I get it now...
Excellent.
Quoteexiftool -composite:cfapattern="[Blue,Green][Green,Red]" -subifd:cfapattern2="2 1 1 0" test.dng
or do the capital letters make a difference?
Close. But you don't write this Composite tag directly. It is a convenience tag derived from the values of CFAPattern2 and CFARepeatPatternDim. See the Composite tags documentation (https://exiftool.org/TagNames/Composite.html) for details.
Ooops. Your "=" has turned into a ":" somehow. I think you mis-typed your command. But it is likely that SubIFD:CFAPattern2 got written properly, so the command probably did what you wanted.
yes that was a typo... Thanks for explaining the composite tag.. it's all starting to make sense!
So I just need to do:
exiftool -SubIFD:CFAPattern2="2 1 1 0" test.dng
I checked it and yes it CFAPattern does change as well!
one other question: is there a way to change how the original is re-named? so instead of it being dsc03747.dng_original, perhaps I
could make it dsc03747-IR.dng
and while I'm asking.. can exiftool also rename the new file as well? perhaps dsc03747-CS.dng that way I can load both versions of the file and easily see which is which.
I realize I can rename the files with a batch command, but I just thought I would ask if exiftool had an option for this
Quote from: jls3512 on August 10, 2013, 10:34:03 AM
is there a way to change how the original is re-named? so instead of it being dsc03747.dng_original, perhaps I
could make it dsc03747-IR.dng
Sorry, no. But you can leave the original the same and write a new name with the
-o option.
Quoteand while I'm asking.. can exiftool also rename the new file as well?
:)
- Phil
That will work nicely, thanks!