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

How to add exposure time into TIFF multi images #412

Closed
ghost opened this issue Mar 12, 2018 · 3 comments
Closed

How to add exposure time into TIFF multi images #412

ghost opened this issue Mar 12, 2018 · 3 comments

Comments

@ghost
Copy link

ghost commented Mar 12, 2018

Hi,

I write a TIFF multi image without problem and I can add some metadata as "software" or "data time".

But I can't add Exposure time for example with a same way:

IIOMetadata metadata = new TIFFImageMetadata(Collections.<Entry>emptySet());

String tiffNativeFormat = TIFFMedataFormat.SUN_NATIVE_IMAGE_METADATA_FORMAT_NAME;
IIOMetadataNode tiffRoot = new IIOMetadataNode(tiffNativeFormat);

IIOMetadataNode tiffIfdNode = new IIOMetadataNode("TIFFIFD");
tiffRoot.appendChild(tiffIfdNode);

createTIFFFieldNode(tiffIfdNode, TIFF.TAG_SOFTWARE, TIFF.TYPE_ASCII, "LFM 1.0");
createTIFFFieldNode(tiffIfdNode, TIFF.TAG_DATE_TIME, TIFF.TYPE_ASCII, strDate);

IIOMetadataNode exifIfdNode = new IIOMetadataNode("TIFFIFD");
exifIfdNode.setAttribute("parentTagNumber", String.valueOf(TIFF.TAG_EXIF_IFD));
tiffIfdNode.appendChild(exifIfdNode);

createTIFFFieldNode(exifIfdNode, EXIF.TAG_DATE_TIME_DIGITIZED, TIFF.TYPE_ASCII, strDate);
createTIFFFieldNode(exifIfdNode, EXIF.TAG_EXPOSURE_TIME, TIFF.TYPE_RATIONAL, ((int)image.getExposureTime()) + "/1000");

metadata.setFromTree(tiffNativeFormat, tiffRoot);

To try to understand, I add exposure time information with exif tool and after I read the metadata and that's what I tried to do in my code without success.

Where is my mistake?

Best regards.

@haraldk
Copy link
Owner

haraldk commented Mar 12, 2018

Hi David,

I think your code is sound.

Unfortunately, only a subset of the TIFF tags are currently copied from the provided metadata into the TIFF structure. These are:

            TIFF.TAG_COMPRESSION * (if compatible, and unless overridden in ImageWriteParam)
            TIFF.TAG_ORIENTATION,
            TIFF.TAG_DATE_TIME,
            TIFF.TAG_DOCUMENT_NAME,
            TIFF.TAG_IMAGE_DESCRIPTION,
            TIFF.TAG_MAKE,
            TIFF.TAG_MODEL,
            TIFF.TAG_PAGE_NAME,
            TIFF.TAG_PAGE_NUMBER,
            TIFF.TAG_ARTIST,
            TIFF.TAG_HOST_COMPUTER,
            TIFF.TAG_COPYRIGHT,
            TIFF.TAG_SOFTWARE *,
            TIFF.TAG_X_RESOLUTION *,
            TIFF.TAG_Y_RESOLUTION *,
            TIFF.TAG_RESOLUTION_UNIT *

*) Will be filled with defaults, if left unspecified.

If time permits, all metadata specified will make it to the TIFF structure in future, but it's unlikely that it happens before 3.5 (unless someone have some spare time for me).

Best regards,

--
Harald K

@ghost
Copy link
Author

ghost commented Mar 12, 2018

Spare time, maybe not but why give a hand on this problem in particular, why not.

Anyway, thanks for your quick reply.

DO

@haraldk
Copy link
Owner

haraldk commented Jan 22, 2020

Should be fixed now, as part of #490

@haraldk haraldk closed this as completed Jan 22, 2020
@haraldk haraldk added this to the 3.5 milestone Jan 22, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant