This is a technical question, that would be best answered by an Adobe employee (not other Adobe product users), preferably one who worked on creating the official DNG specification in the first place.
For a the simplest possible DNG file (a monochrome image), what are the minimum required tags?
Obviously it needs these 2 tags in IFD0: 0x014A (SubIFDs) and 0xC612 (DNGVersion).
The first of these provides a file offset for the raw subIFD.
The second one tells the reader that the file is a DNG file, and what version of DNG it is.
Though IFD0 itself can contain a low resolution preview image, I don't think it needs to to fit the official DNG specs (but I might be mistaken about this).
Then in the raw IFD one obviously needs to have these tags:
0x100 image width
0x101 image height
0x102 bit depth (this is usually 16 bits per channel)
0x103 compression (which must be either uncompressed, or compressed in a way allowed by the DNG specs)
0x106 photometric interpretation (which must be 34892 for linear raw, and it must be linear raw for monochrome)
0x111 strip offsets (this points to the raw image data in the file)
0x115 samples per pixel (this tells you the number of channels the image has, and must be 1 for monochrome)
0x116 rows per strip (which is equal to the image height if the whole image is a single strip)
0x117 strip byte count (which is equal to the total number of bytes in the image if the image is a single strip)
Ok, those are obviously required, but are there any others that are also required? For a simple monochrome image I can obviously skip the tags relating to color space, and white balance, such as the xyz coordinates of the white point and the illuminant standard. However I think there may be more required tags, even for a simple monochrome image. The reason I say that is this. I wrote a program that generates monochrome DNG test images. These images have the 2 tags I mentioned in IFD0, and the 9 tags I mentioned in the raw IFD.
Now these test DNG images I created are loaded perfectly fine in the 3rd party software called DCRaw (which successfully converts them to standard TIF or PPM images). So at least DCRaw thinks the DNG files in question are up to spec, but what about 1st party Adobe software? Well that's where I have the problem. The problem happens when I try to load the test DNG images into Photoshop via the Adobe Camera Raw plugin (which comes with Photoshop). By the way, I don't know if it matters, but I'm using Photoshop Elements (not standard Photoshop). The error it gives me unfortunately is very generic. It doesn't tell me at all what is wrong with my DNG file. It doesn't say something like "the DNG file is missing tag xxxxxx", or anything like that. So I have no way of knowing what is wrong with my DNG test files. All it says is:
Photoshop Elements cannot open this file.
If you are attempting to open a raw file from a
digital camera, make sure you have the latest
Camera Raw update installed via Help > Updates...
If the problem persists, visit the following
link for more information
So please, if you are an Adobe employee, please tell me what is wrong with the way I've been generating these DNG test files, if in fact I'm not using enough tags to make the file a valid DNG file. And also tell me please, what the minimum requirements are, in terms of which tags are the bare requirements for having a valid DNG file.
Is dng_validate a command that I can run from Photoshop? Or is it its own separate program? Please let me know. Thanks.
It is part of the DNG SDK, downloadable from Adobe.
Ok. Thanks. I eventually figured that out, and have since tested my DNG files, and made enough corrections to get them to load in Photoshop.
So, as I mentioned above, I am now able to generate DNG files that work with Photoshop. The one tag that seemed to be the problem was that the raw subIFD previously had not had the NewSubFileType tag. I had assumed it was optional, because according to the TIFF specification, if the tag isn't included, the default value of 0 (zero) is assumed for this tag (software reading it is supposed to proceed as if the tag were included and its value was set to 0). But (though this isn't mentioned in the DNG specification), it appears that the raw subIFD does in fact (at least for Photoshop's Camera Raw plugin to read it) require the NewSubFileType tag, and its value must be 0. Interestingly enough, other tags, such as the Orientation tag, that (according to the DNG specification, as of version 184.108.40.206) are in fact required, Photoshop's Camera Raw plugin can actually read DNG files without some of these. For example, with the Orientation tag, if that is missing from the DNG file, the Camera Raw plugin will treat the image as having its first pixel in the upper-left corner, and that increasing offsets in the file represent going through the pixels in the image from left to right, then top to bottom.
Currently, my test DNG image that my program generates has these tags.
In IFD0 it has these 2 tags:
0x14A (SubIFDs), Long, 1 value, offset to raw IFD
0xC612 (DNGVersion), Byte, 4 values, 0x01 0x04 0x00 0x00
In the raw subIFD it has these 10 tags:
0xFE (NewSubFileType), Long, 1 value, 0
0x100 (ImageWidth), Long, 1 value, image width
0x101 (ImageLength), Long, 1 value, image height
0x102 (BItDepth), Short, 1 value, 16
0x103 (Compression), Short, 1 value, 1 (uncompressed)
0x106 (PhotometricInterpretation), Short, 1 value, 34892 (linear raw)
0x111 (StripOffsets), Long, 1 value, offset to image bytes
0x115 (SamplesPerPixel), Short, 1 value, 1 (number of color channels, 1 for monochrome)
0x116 (RowsPerStrip), Long, 1 value, image height
0x117 (StripByteCounts), Long, 1 value, number of bytes in the image (width * height * bytes per pixel)
So, at least to make Photoshop load a DNG file without generating any errors, these 12 tags (2 in IFD0, and 10 in the raw subIFD) appear to be the bare minimum required tags.