Packages

 

com.aspose.psd.imageoptions

Class PngOptions



  • public class PngOptions
    extends ImageOptionsBase

    The png file format create options.

    Code example:

    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();
    }
    

    • Field Detail

      • DEFAULT_COMPRESSION_LEVEL

        public static final int DEFAULT_COMPRESSION_LEVEL

        The default compression level.

        See Also:
        Constant Field Values
    • Constructor Detail

      • PngOptions

        public PngOptions()

        Initializes a new instance of the PngOptions class.

      • PngOptions

        public PngOptions(PngOptions pngOptions)

        Initializes a new instance of the JpegOptions class.

        Parameters:
        pngOptions - The PNG options.
    • Method Detail

      • getColorType

        public int getColorType()

        Gets or sets the type of the color.

        Returns:
        The type of the color.
        See Also:
        PngColorType
      • setColorType

        public void setColorType(int value)

        Gets or sets the type of the color.

        Parameters:
        value - The type of the color.
        See Also:
        PngColorType
      • getProgressive

        public boolean getProgressive()

        Gets or sets a value indicating whether this PngOptions is progressive.

        Returns:
        true if progressive; otherwise, false.
      • setProgressive

        public void setProgressive(boolean value)

        Gets or sets a value indicating whether this PngOptions is progressive.

        Parameters:
        value - true if progressive; otherwise, false.
      • getFilterType

        public int getFilterType()

        Gets or sets the filter type used during png file save process.

        Returns:
        the filter type used during png file save process.
        See Also:
        PngFilterType
      • setFilterType

        public void setFilterType(int value)

        Gets or sets the filter type used during png file save process.

        Parameters:
        value - the filter type used during png file save process.
        See Also:
        PngFilterType
      • getCompressionLevel

        public int getCompressionLevel()

        The png image compression level in the 0-9 range, where 9 is maximum compression and 0 is store mode.

        Returns:
        the compression level in the 0-9 range, where 9 is maximum compression and 0 is store mode.
      • setCompressionLevel

        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.

        Parameters:
        value - the compression level in the 0-9 range, where 9 is maximum compression and 0 is store mode.
      • getBitDepth

        public byte getBitDepth()

        Gets the bit depth.

        Returns:
        The bit depth.
      • setBitDepth

        public void setBitDepth(byte value)

        Sets the bit depth.

        Parameters:
        value - The bit depth.