All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.twelvemonkeys.imageio.plugins.hdr.HDRMetadata Maven / Gradle / Ivy

There is a newer version: 3.12.0
Show newest version
package com.twelvemonkeys.imageio.plugins.hdr;

import com.twelvemonkeys.imageio.StandardImageMetadataSupport;

import javax.imageio.ImageTypeSpecifier;
import javax.imageio.metadata.IIOMetadataNode;

final class HDRMetadata extends StandardImageMetadataSupport {
    public HDRMetadata(ImageTypeSpecifier type, HDRHeader header) {
        super(builder(type)
                      .withCompressionTypeName("RLE")
                      .withTextEntry("Software", header.getSoftware()));
    }

    // For HDR, the stored sample data is UnsignedIntegral and data is 4 channels (RGB+Exp),
    // but decoded to Real (float) 3 chanel RGB
    @Override
    protected IIOMetadataNode getStandardDataNode() {
        IIOMetadataNode node = new IIOMetadataNode("Data");

        IIOMetadataNode sampleFormat = new IIOMetadataNode("SampleFormat");
        sampleFormat.setAttribute("value", "UnsignedIntegral");
        node.appendChild(sampleFormat);

        IIOMetadataNode bitsPerSample = new IIOMetadataNode("BitsPerSample");
        bitsPerSample.setAttribute("value", "8 8 8 8");
        node.appendChild(bitsPerSample);

        return node;
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy