I'm working on a program to wrap image info into a dng format, but have run into a snag that I cannot find in the documentation. I'll start off with the verbose output of dng_validate:
Uses little-endian byte order
Magic number = 42
IFD 0: Offset = 8, Entries = 20
NewSubFileType: Preview Image
BitsPerSample: 8 8 8
Make: "Test Program"
StripOffsets: Offset = 386
Orientation: 1 - 0th row is top, 0th column is left
StripByteCounts: Count = 7626
DateTime: 1900:01:01 00:00:00
SubIFDs: IFD = 8012
UniqueCameraModel: "Test Program"
NextIFD = 0
SubIFD 1: Offset = 8012, Entries = 10
NewSubFileType: Main Image
BitsPerSample: 16 16 16
StripOffsets: Offset = 8144
StripByteCounts: Count = 4002000
NextIFD = 0
*** Error: Missing or invalid SamplesPerPixel (SubIFD 1) ***
So obviously SamplesPerPixel is present in SubIFD 1, and I've seen plenty of dngs that have LinearRaw with 3 channels. The image won't open in photoshop or in lightroom and I can't find any indication as to what the actual problem is. Help greatly appreciated. Thanks.
Your DNG is missing a whole lot of required tags. The specific error is probably because there aren't color matrixes, and I think that DNG_validate uses the size of the color matrixes to work out how many color planes there are. SamplesPerPixel of three only makes sense for three color planes.
Thanks for the reply. ColorMatrix1 was definitely missing, and its addition now passes dng_validate. Is there a reference for how the color matrix is calculated? In some use cases, I'm storing demosaicized RGB images in DNG as a temporary container, but they appear white-washed when opened.