[OpenJDK 2D-Dev] [9] RFC JDK-8154058: [TIFF] ignoreMetadata parameter of TIFFImageReader's setInput() method affects TIFFImageReadParam in non-obvious way
Brian Burkhalter
brian.burkhalter at oracle.com
Tue Oct 18 23:02:09 UTC 2016
It seems that there might be in effect three scenarios worth considering:
A) Ignore all metadata (ignoreMetadata [1] is true)
No metadata would be read except that required to read the image itself. This is related to another issue [2]. It is debatable whether any such essential metadata should be propagated to the ImageMetadata despite ignoreMetadata’s being true.
B) Ignore only metadata unknown to the TIFFImageReadParam (ignoreMetadata is false)
Only metadata essential to reading the image or corresponding to TIFFTags present in the union of TIFFTagSets set on the TIFFImageReadParam would be read. Similarly to scenario (A), it is be debatable whether metadata essential to reading the image should be propagated to the ImageMetadata if there is no corresponding tag in the union of known TIFFTagSets. Note that the absence of a provided TIFFImageReadParam implies that the default TIFFTagSets delineated in the class description of TIFFImageReadParam [3] would be recognized.
C) Do not ignore any metadata (ignoreMetadata is false)
All metadata would be read including that corresponding to TIFFTags not present in the union of TIFFTagSets set on the TIFFImageReadParam.
The foregoing set of scenarios would allow the blanket disabling of reading metadata as intended by [1], while retaining the ability to have fine-grained control over which fields are read as intended by the original TIFF plugin code [4]. In order to distinguish between scenarios (B) and (C) an extra setting, e.g., “ignoreUnknownTags” on the TIFFImageReadParam would be required, and any other pertinent API documentation updated, including [4].
Brian
[1] http://download.java.net/java/jdk9/docs/api/javax/imageio/ImageReader.html#ignoreMetadata
[2] https://bugs.openjdk.java.net/browse/JDK-8164750
[3] http://download.java.net/java/jdk9/docs/api/javax/imageio/plugins/tiff/TIFFImageReadParam.html
[4] http://download.java.net/java/jdk9/docs/api/javax/imageio/metadata/doc-files/tiff_metadata.html#MetadataIssuesRead
On Aug 17, 2016, at 11:09 AM, Phil Race <philip.race at oracle.com> wrote:
> That all seems fine (for the case of ignoreMetaData == true).
>
> But there may be still a bug - of some kind - uncovered by this test.
> The submitter has this case :
>
> ignore = false:
> EXIF: true
> Fax : true
> GPS : true
>
> which means that all metadata is being read .. as is the default per the docs
> on the TIFF package description. But I am wondering what the effect setting of
>
> param.removeAllowedTagSet(FaxTIFFTagSet.getInstance());
>
> should have been in this case.
> A strict reading of the spec. makes it sound like it only has any effect
> when you specify ignoreMetadata == true but I don't see the point
> of the API in that case, since you are already ignoring metadata, unless
> it is just a matter of being more clear to the reader that the latitude
> it has to read metadata anyway regardless should be tempered by
> this additional call.
>
> But is there not also value in being able to remove the tag from
> the allowed set in the ignoreMetadata == false case ?
>
> That seemed to be the gist of the text here :-
> >In cases where the IFD includes fields which contain
> > large amounts of data this could be very inefficient.
> > Which fields are loaded may be controlled by setting
> >which TIFF tags the reader is allowed to recognize and whether it is ignoring metadata.
>
> eg .. "I want all metadata except Fax" ..
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.openjdk.java.net/pipermail/2d-dev/attachments/20161018/0fa22158/attachment.html>
More information about the 2d-dev
mailing list