Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Why does PiDNG store all tags in IFD0 ? #65

Open
pinchartl opened this issue Jul 7, 2022 · 0 comments
Open

Why does PiDNG store all tags in IFD0 ? #65

pinchartl opened this issue Jul 7, 2022 · 0 comments

Comments

@pinchartl
Copy link

It recently came to my attention, through a patch sent to the libcamera mailing list (https://lists.libcamera.org/pipermail/libcamera-devel/2022-July/032036.html), that PiDNG stores all tags in IFD0.

The DNG specification (https://helpx.adobe.com/content/dam/help/en/photoshop/pdf/dng_spec_1_6_0_0.pdf) states the following, in the subIFDs trees section:

DNG recommends the use of SubIFD trees, as described in the TIFF-EP
specification. SubIFD chains are not supported.

The highest-resolution and quality IFD should use NewSubFileType
equal to 0. Reduced resolution (or quality) thumbnails or previews,
if any, should use NewSubFileType equal to 1 (for a primary preview)
or 10001.H (for an alternate preview).

DNG recommends, but does not require, that the first IFD contain a
low-resolution thumbnail, as described in the TIFF-EP specification.

and in the metadata section:

Additional metadata may be embedded in DNG in the following ways:

• Using TIFF-EP or EXIF metadata tags
• Using the IPTC metadata tag (33723)
• Using the XMP metadata tag (700)

Note that TIFF-EP and EXIF use nearly the same metadata tag set, but
TIFF-EP stores the tags in IFD 0, while EXIF store the tags in a
separate IFD. Either location is allowed by DNG, but the EXIF
location is preferred.

While the DNG specification seems to allow storing the EXIF tags in IFD0, as well as storing the main image there too, that isn't recommended. I would thus like to know why PiDNG does it this way, and if you are maybe following a newer or better specification or recommendation I would have missed.

will-v-pi added a commit to raspberrypi/libcamera that referenced this issue Jul 14, 2022
…amera2

The DNG specification is based on the TIFF file format and recommends
storing the raw image data in a SubIFD and the Exif tags in an Exif IFD.
Other options are allowed, even if not recommended, such as storing both
the raw image data and the Exif data in IFD0, as done by the TIFF/EP
specification.

libcamera-apps use pyexiv2 to produce DNG files, following the DNG
recommendation, while applications based on picamera2 use PiDNG, which
adopts the TIFF/EP structure. Why it does so is not currently clear (see
schoolpost/PiDNG#65 for discussions on this
topic), but as files based on the DNG and TIFF/EP variants exist in the
wild, both need to be supported by ctt.

Add code to identify which tags are being used, and then load the
metadata from the correct tags.

Signed-off-by: William Vinnicombe <william.vinnicombe@raspberrypi.com>
will-v-pi added a commit to raspberrypi/libcamera that referenced this issue Aug 3, 2022
…amera2

The DNG specification is based on the TIFF file format and recommends
storing the raw image data in a SubIFD and the Exif tags in an Exif IFD.
Other options are allowed, even if not recommended, such as storing both
the raw image data and the Exif data in IFD0, as done by the TIFF/EP
specification.

libcamera-apps use pyexiv2 to produce DNG files, following the DNG
recommendation, while applications based on picamera2 use PiDNG, which
adopts the TIFF/EP structure. Why it does so is not currently clear (see
schoolpost/PiDNG#65 for discussions on this
topic), but as files based on the DNG and TIFF/EP variants exist in the
wild, both need to be supported by ctt.

Add code to identify which tags are being used, and then load the
metadata from the correct tags.

Signed-off-by: William Vinnicombe <william.vinnicombe@raspberrypi.com>
christianrauch pushed a commit to christianrauch/libcamera that referenced this issue Aug 3, 2022
…amera2

The DNG specification is based on the TIFF file format and recommends
storing the raw image data in a SubIFD and the Exif tags in an Exif IFD.
Other options are allowed, even if not recommended, such as storing both
the raw image data and the Exif data in IFD0, as done by the TIFF/EP
specification.

libcamera-apps use pyexiv2 to produce DNG files, following the DNG
recommendation, while applications based on picamera2 use PiDNG, which
adopts the TIFF/EP structure. Why it does so is not currently clear (see
schoolpost/PiDNG#65 for discussions on this
topic), but as files based on the DNG and TIFF/EP variants exist in the
wild, both need to be supported by ctt.

Add code to identify which tags are being used, and then load the
metadata from the correct tags.

Signed-off-by: William Vinnicombe <william.vinnicombe@raspberrypi.com>
Reviewed-by: David Plowman <david.plowman@raspberrypi.com>
Reviewed-by: Naushir Patuck <naush@raspberrypi.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant