Hi.
Is there any way to write MaskedAreas tag into existing DNG file?
I know it's image data related tag and can't contain random data, but I need to add it for development reasons.
There are some DNG images shot by the same camera (native DNG support), and there is masked area in the RAW data.
But previous firmware versions does not store MaskedAreas tag, while newer does, and I want to add this tag manually to images shot with previous firmware.
I've tried (random values, just for example): exiftool -MaskedAreas="0 0 4096 128" image.dng , but exiftool prints that no images were updated.
Is there a way to do this?
If you check the tag name documentation (https://exiftool.org/TagNames/EXIF.html), you'll see that MaskedAreas is in the SubIFD group. This means that it will be written to the SubIFD by default if you don't specify another group. Since ExifTool will not create a new SubIFD, this tag will only get written if a SubIFD already exists. However, I would expect the SubIFD to exist in any DNG image, but you can check with exiftool -a -g1.
- Phil
Thanks for your answer, that was really fast. :)
You are right, I've missed that MaskedAreas tag is by default stored in SubIFD.
In this images there are no SubIFD's at all, only IFD0 - RAW image tags, and EXIF_IFD - exif tags.
According to DNG specification, MaskedAreas should be stored in "Raw IFD", so they are stored in IFD0.
This command works fine for me: exiftool -IFD0:MaskedAreas="0 0 4096 128" image.dng
Thanks again for your help.
Glad this worked, but I'm a bit dissapointed in this variability of the DNG because it makes life harder for exiftool users since tags are written to specific IFD's.
In all DNG's I have seen, the RAW IFD is the first SubIFD. What wrote your DNG image?
- Phil
It's a custom firmware for compact digital camera, not publicly available.
Still it's a valid DNG, it passes dng_validate from DNG_SDK without any errors or warnings.
I think this should be the case for DNG files without thumbnail and preview (not really wide spread).
Software that runs on computer (Adobe DNG Converter for example) always create thumbnail and preview, but this firmware does not for speed reasons...
And even with thumbnail it is not required to have SubIFD - it's allowed (but not recommended, treated as outdated) to have IFD chains (instead of IFD trees).
So in general MaskedAreas could be present in IFD1, not SubIFD too.
It's not possible to assume one place for this tag, I think your assumption of SubIFD is most common case, so it's just fine.
And one more question - is it possible to create new IFD or SubIFD with exiftool, and if so - how to do this?
Thanks for the explanation.
ExifTool will create the following IFD's in a TIFF-format image:
IFD1
ExifIFD
GPS IFD
GlobParamIFD
InteropIFD
You do this by writing any tag to the IFD.
- Phil