public class PngOptions extends ImageOptionsBase
The png file format create options.
An example of converting from an AI file of version 8 to the PSD and PNG file formats. It just loads an existing AI file then saves two copies in the appropriate file formats.
String inAiFilePath = "form_8.ai"; String outPsdFilePath = "form_8_export.psd"; String outPngFilePath = "form_8_export.png"; // Load an AI file of 8 version AiImage aiImage = (AiImage)Image.load(inAiFilePath); try { // Export the loaded AI file to the PSD file format with default options aiImage.save(outPsdFilePath, new PsdOptions()); // Save the loaded AI file as a PNG file with a white background PngOptions pngOptions = new PngOptions(); pngOptions.setColorType(PngColorType.TruecolorWithAlpha); aiImage.save(outPngFilePath, pngOptions); } finally { aiImage.dispose(); }
Modifier and Type | Field and Description |
---|---|
static int |
DEFAULT_COMPRESSION_LEVEL
The default compression level.
|
Constructor and Description |
---|
PngOptions()
Initializes a new instance of the
PngOptions class. |
PngOptions(PngOptions pngOptions)
Initializes a new instance of the
JpegOptions class. |
Modifier and Type | Method and Description |
---|---|
byte |
getBitDepth()
Gets the bit depth.
|
int |
getColorType()
Gets or sets the type of the color.
|
int |
getCompressionLevel()
The png image compression level in the 0-9 range, where 9 is maximum compression and 0 is store mode.
|
int |
getFilterType()
Gets or sets the filter type used during png file save process.
|
boolean |
getProgressive()
Gets or sets a value indicating whether this
PngOptions is progressive. |
XmpPacketWrapper |
getXmpData()
Gets or sets the XMP metadata container.
|
void |
setBitDepth(byte value)
Sets the bit depth.
|
void |
setColorType(int value)
Gets or sets the type of the color.
|
void |
setCompressionLevel(int value)
The png image compression level in the 0-9 range, where 9 is maximum compression and 0 is store mode.
|
void |
setFilterType(int value)
Gets or sets the filter type used during png file save process.
|
void |
setProgressive(boolean value)
Gets or sets a value indicating whether this
PngOptions is progressive. |
void |
setXmpData(XmpPacketWrapper value)
Gets or sets the XMP metadata container.
|
clone, deepClone, getBufferSizeHint, getDefaultReplacementFont, getFullFrame, getMultiPageOptions, getPalette, getProgressEventHandler, getResolutionSettings, getSource, getVectorRasterizationOptions, setBufferSizeHint, setDefaultReplacementFont, setFullFrame, setMultiPageOptions, setPalette, setProgressEventHandler, setResolutionSettings, setSource, setVectorRasterizationOptions
close, dispose, getDisposed
public static final int DEFAULT_COMPRESSION_LEVEL
The default compression level.
public PngOptions()
Initializes a new instance of the PngOptions
class.
public PngOptions(PngOptions pngOptions)
Initializes a new instance of the JpegOptions
class.
pngOptions
- The PNG options.public XmpPacketWrapper getXmpData()
Gets or sets the XMP metadata container.
Value: The XMP data container.getXmpData
in class ImageOptionsBase
public void setXmpData(XmpPacketWrapper value)
Gets or sets the XMP metadata container.
Value: The XMP data container.setXmpData
in class ImageOptionsBase
public int getColorType()
Gets or sets the type of the color.
PngColorType
public void setColorType(int value)
Gets or sets the type of the color.
value
- The type of the color.PngColorType
public boolean getProgressive()
Gets or sets a value indicating whether this PngOptions
is progressive.
true
if progressive; otherwise, false
.public void setProgressive(boolean value)
Gets or sets a value indicating whether this PngOptions
is progressive.
value
- true
if progressive; otherwise, false
.public int getFilterType()
Gets or sets the filter type used during png file save process.
PngFilterType
public void setFilterType(int value)
Gets or sets the filter type used during png file save process.
value
- the filter type used during png file save process.PngFilterType
public int getCompressionLevel()
The png image compression level in the 0-9 range, where 9 is maximum compression and 0 is store mode.
public void setCompressionLevel(int value)
The png image compression level in the 0-9 range, where 9 is maximum compression and 0 is store mode.
value
- the compression level in the 0-9 range, where 9 is maximum compression and 0 is store mode.public byte getBitDepth()
Gets the bit depth.
public void setBitDepth(byte value)
Sets the bit depth.
value
- The bit depth.