private void parse_sBIT_chunk(PNGChunk chunk) {
        if (colorType == PNG_COLOR_PALETTE) {
            significantBits = new int[3];
        } else {
            significantBits = new int[inputBands];
        }
        for (int i = 0; i < significantBits.length; i++) {
            int bits = chunk.getByte(i);
            int depth = (colorType == PNG_COLOR_PALETTE) ? 8 : bitDepth;
            if (bits <= 0 || bits > depth) {
                // Error -- significant bits must be between 0 and
                // image bit depth.
                String msg = PropertyUtil.getString("PNGImageDecoder13");
                throw new RuntimeException(msg);
            }
            significantBits[i] = bits;
        }

        if (encodeParam != null) {
            encodeParam.setSignificantBits(significantBits);
        }
        if (emitProperties) {
            properties.put("significant_bits", significantBits);
        }
    }
A convenience method to create an instance of
<code>ComponentColorModel</code> suitable for use with the
given <code>SampleModel</code>.  The <code>SampleModel</code>
should have a data type of <code>DataBuffer.TYPE_BYTE</code>,
<code>TYPE_USHORT</code>, or <code>TYPE_INT</code> and between
1 and 4 bands.  Depending on the number of bands of the
<code>SampleModel</code>, either a gray, gray+alpha, rgb, or
rgb+alpha <code>ColorModel</code> is returned.
plugins/svg-plugin/batik-codec-fix/src/main/java/org/apache/batik/ext/awt/image/codec/png/PNGRed.java