As a workaround I changed the type to undefined in my file.
I was just wondering if this behavior could be changed, as TIFFField.getAsBytes() also supports TIFFTag.TIFF_BYTE. Since many cases where you are using the byte type would be for long tag values like this, you wouldn't want it creating metadata nodes for each individual byte.
Of course, the native metadata format could be documented somewhere as "fields of type byte are always split up into a list of child metadata nodes" and then you probably wouldn't want to change this.
I have XMP data in a TIFF I'm reading (it's large, about 30 MB, but not OutOfMemoryError large).
I set the field type as byte as based on XMP docs. But the way it gets set up in https://github.com/jai-imageio/jai-imageio-core/blob/3f9c4019d0596d1589282a2ca9d5864fe2b8cfd2/src/main/java/com/github/jaiimageio/impl/plugins/tiff/TIFFFieldNode.java#L141 is that it creates an IIOMetadataNode for each byte. I think this is the part that causes the memory error.
As a workaround I changed the type to undefined in my file.
I was just wondering if this behavior could be changed, as
TIFFField.getAsBytes()
also supportsTIFFTag.TIFF_BYTE
. Since many cases where you are using the byte type would be for long tag values like this, you wouldn't want it creating metadata nodes for each individual byte.Of course, the native metadata format could be documented somewhere as "fields of type byte are always split up into a list of child metadata nodes" and then you probably wouldn't want to change this.