//that happens.
if (params.getResolution() != null) {
if (SUN_TIFF_NATIVE_FORMAT.equals(meta.getNativeMetadataFormatName())) {
//IIOMetadataNode root = (IIOMetadataNode)meta.getAsTree(SUN_TIFF_NATIVE_FORMAT);
IIOMetadataNode root = new IIOMetadataNode(SUN_TIFF_NATIVE_FORMAT);
IIOMetadataNode ifd = getChildNode(root, "TIFFIFD");
if (ifd == null) {
ifd = new IIOMetadataNode("TIFFIFD");
ifd.setAttribute("tagSets",
"com.sun.media.imageio.plugins.tiff.BaselineTIFFTagSet");
root.appendChild(ifd);
}
ifd.appendChild(createResolutionField(282, "XResolution", params));
ifd.appendChild(createResolutionField(283, "YResolution", params));
//ResolutionUnit
IIOMetadataNode field, arrayNode, valueNode;
field = new IIOMetadataNode("TIFFField");
field.setAttribute("number", Integer.toString(296));
field.setAttribute("name", "ResolutionUnit");
arrayNode = new IIOMetadataNode("TIFFShorts");
field.appendChild(arrayNode);
valueNode = new IIOMetadataNode("TIFFShort");
valueNode.setAttribute("value", Integer.toString(3));
valueNode.setAttribute("description", "Centimeter");
arrayNode.appendChild(valueNode);
try {