bitDepthSet

PNGEncodeParam

getDefaultEncodeParam

Returns an instance of PNGEncodeParam.Palette,
PNGEncodeParam.Gray, or
PNGEncodeParam.RGB appropriate for encoding
the given image.

If the image has an IndexColorModel, an
instance of PNGEncodeParam.Palette is returned.
Otherwise, if the image has 1 or 2 bands an instance of
PNGEncodeParam.Gray is returned. In all other
cases an instance of PNGEncodeParam.RGB is
returned.

Note that this method does not provide any guarantee that
the given image will be successfully encoded by the PNG
encoder, as it only performs a very superficial analysis of
the image structure.

setBitDepth

public abstract void setBitDepth(int bitDepth)

Sets the desired bit depth of an image.

getBitDepth

public int getBitDepth()

Returns the desired bit depth for a grayscale image.

If the bit depth has not previously been set, or has been
unset, an IllegalStateException will be thrown.

unsetBitDepth

Suppresses the setting of the bit depth of a grayscale image.
The depth of the encoded image will be inferred from the source
image bit depth, rounded up to the next power of 2 between 1
and 16.

setInterlacing

public void setInterlacing(boolean useInterlacing)

Turns Adam7 interlacing on or off.

getInterlacing

public boolean getInterlacing()

Returns true if Adam7 interlacing will be used.

unsetBackground

public void unsetBackground()

Suppresses the 'bKGD' chunk from being output.
For API compatibility with JAI 1.0, the superclass
defines this method to throw a RuntimeException;
accordingly, subclasses must provide their own implementations.

isBackgroundSet

public boolean isBackgroundSet()

Returns true if a 'bKGD' chunk will be output.
For API compatibility with JAI 1.0, the superclass
defines this method to throw a RuntimeException;
accordingly, subclasses must provide their own implementations.

setChromaticity

public void setChromaticity(float[] chromaticity)

Sets the white point and primary chromaticities in CIE (x, y)
space.

The chromaticity parameter should be a
float array of length 8 containing the white point
X and Y, red X and Y, green X and Y, and blue X and Y values in
order.

unsetICCProfileData

isICCProfileDataSet

public boolean isICCProfileDataSet()

Returns true if a 'iCCP' chunk will be output.

setPhysicalDimension

public void setPhysicalDimension(int[] physicalDimension)

Sets the physical dimension information to be stored with this
image. The physicalDimension parameter should be a 3-entry
array containing the number of pixels per unit in the X
direction, the number of pixels per unit in the Y direction,
and the unit specifier (0 = unknown, 1 = meters).

unsetSignificantBits

isSignificantBitsSet

public boolean isSignificantBitsSet()

Returns true if an 'sBIT' chunk will be output.

setSRGBIntent

public void setSRGBIntent(int SRGBIntent)

Sets the sRGB rendering intent to be stored with this image.
The legal values are 0 = Perceptual, 1 = Relative Colorimetric,
2 = Saturation, and 3 = Absolute Colorimetric. Refer to the
PNG specification for information on these values.

The 'sRGB' chunk will encode this information.

getSRGBIntent

public int getSRGBIntent()

Returns the sRGB rendering intent to be stored with this image.

If the sRGB intent has not previously been set, or has been
unset, an IllegalStateException will be thrown.

filterRow

Performs filtering on a row of an image. This method may be
overridden in order to provide a custom algorithm for choosing
the filter type for a given row.

The method is supplied with the current and previous rows
of the image. For the first row of the image, or of an
interlacing pass, the previous row array will be filled with
zeros as required by the PNG specification.

The method is also supplied with five scratch arrays.
These arrays may be used within the method for any purpose.
At method exit, the array at the index given by the return
value of the method should contain the filtered data. The
return value will also be used as the filter type.

The default implementation of the method performs a trial
encoding with each of the filter types, and computes the sum of
absolute values of the differences between the raw bytes of the
current row and the predicted values. The index of the filter
producing the smallest result is returned.

As an example, to perform only 'sub' filtering, this method
could be implemented (non-optimally) as follows:

currRow - The current row as an array of bytes
of length at least bytesPerRow + bytesPerPixel.
The pixel data starts at index bytesPerPixel;
the initial bytesPerPixel bytes are zero.

prevRow - The current row as an array of bytes
The pixel data starts at index bytesPerPixel;
the initial bytesPerPixel bytes are zero.

scratchRows - An array of 5 byte arrays of
length at least bytesPerRow +
bytesPerPixel, useable to hold temporary results.
The filtered row will be returned as one of the entries
of this array. The returned filtered data should start
at index bytesPerPixel; The initial
bytesPerPixel bytes are not used.

bytesPerRow - The number of bytes in the image row.
This value will always be greater than 0.

bytesPerPixel - The number of bytes representing a single
pixel, rounded up to an integer. This is the 'bpp' parameter
described in the PNG specification.

Returns:

The filter type to be used. The entry of
scratchRows[] at this index holds the
filtered data.