drewnoakes / metadata-extractor-dotnet

Extracts Exif, IPTC, XMP, ICC and other metadata from image, video and audio files
Other
944 stars 170 forks source link

Decode CFA Pattern #81

Closed drewnoakes closed 7 years ago

drewnoakes commented 7 years ago

We currently show CFA pattern as a series of integers, for example:

[Exif SubIFD - 0x828e] CFA Pattern = 1 2 0 1

From this site, these numbers map to filter colours:

0 = Red
1 = Green
2 = Blue
3 = Cyan
4 = Magenta
5 = Yellow
6 = White

So the above example could better be described as:

[Exif SubIFD - 0x828e] CFA Pattern = Green, Blue, Red, Green
drewnoakes commented 7 years ago

Note there are two CFA Pattern tags. This should apply to both.

kwhopper commented 7 years ago

This is hard to piece together, but I think the difference is whether the file is RAW and possibly of certain flavors: http://www.digitalpreservation.gov/formats/content/tiff_tags.shtml

Tag 0xA302 is the more general of the two and isn't RAW-specific. It's more difficult to work with since it's binary and you have to figure out the repeating pattern yourself. Tags 0x828D (repeat pattern dim) and 0x828E go together; the "repeat pattern" defines how many times the "cfa pattern" is repeated. Since neither is in a binary format, they can be used to reconstruct the entire CFA Pattern more easily. It appears most NEF files in the images repo set both tags but the rest appear to hold one or the other.

I put a "2" on the end of this description only to match Exiftool. Maybe Phil H. wanted to create some distinction but hard to say. It seems ok to not make a descriptive distinction here since they both - at least on the surface - describe the 'same' thing.

kwhopper commented 7 years ago

If there's ever some kind of "composite" directory, both of these Pattern tags could be replaced with one Composite. They describe the same data.

drewnoakes commented 7 years ago

Thanks for delving into this and sharing your findings. The PR is great.

We can put the '2' suffix back in this name. For the new API I anticipate a distinction between a tag's friendly name and its ID. Currently these are the same thing, which makes it unclear whether to be human friendly or unique.