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, setVectorRasterizationOptionsclose, dispose, getDisposedpublic 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 ImageOptionsBasepublic void setXmpData(XmpPacketWrapper value)
Gets or sets the XMP metadata container.
Value: The XMP data container.setXmpData in class ImageOptionsBasepublic int getColorType()
Gets or sets the type of the color.
PngColorTypepublic void setColorType(int value)
Gets or sets the type of the color.
value - The type of the color.PngColorTypepublic 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.
PngFilterTypepublic 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.PngFilterTypepublic 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.