Packages

 

com.aspose.imaging.imageoptions

Class Jpeg2000Options

    • Constructor Detail

      • Jpeg2000Options

        public Jpeg2000Options()

        Initializes a new instance of the Jpeg2000Options class.

      • Jpeg2000Options

        public Jpeg2000Options(Jpeg2000Options jpeg2000Options)

        Initializes a new instance of the Jpeg2000Options class.

        Parameters:
        jpeg2000Options - The Jpeg2000 file format options to copy settings from.
    • Method Detail

      • getComments

        public String[] getComments()

        Gets or sets the Jpeg comment markers.

        Returns:
        The Jpeg comment markers.
      • setComments

        public void setComments(String[] value)

        Gets or sets the Jpeg comment markers.

        Parameters:
        value - The Jpeg comment markers.
      • getCodec

        public int getCodec()

        Gets or sets the JPEG2000 codec

        Returns:
        The JPEG2000 codec
        See Also:
        Jpeg2000Codec
      • setCodec

        public void setCodec(int value)

        Gets or sets the JPEG2000 codec

        Parameters:
        value - The JPEG2000 codec
        See Also:
        Jpeg2000Codec
        Code example:

        This example shows how to create a PNG image and save it to JPEG2000 with the desired options.


        String dir = "c:\\temp\\";
        
        // Create a PNG image of 100x100 px.
        com.aspose.imaging.fileformats.png.PngImage pngImage = new com.aspose.imaging.fileformats.png.PngImage(100, 100);
        try {
            com.aspose.imaging.Graphics graphics = new com.aspose.imaging.Graphics(pngImage);
        
            // Fill the entire image in red.
            com.aspose.imaging.brushes.SolidBrush brush = new com.aspose.imaging.brushes.SolidBrush(com.aspose.imaging.Color.getRed());
            graphics.fillRectangle(brush, pngImage.getBounds());
        
            com.aspose.imaging.imageoptions.Jpeg2000Options saveOptions = new com.aspose.imaging.imageoptions.Jpeg2000Options();
        
            // Use the irreversible Discrete Wavelet Transform 9-7
            saveOptions.setIrreversible(true);
        
            // JP2 is the "container" format for JPEG 2000 codestreams.
            // J2K is raw compressed data, without a wrapper.
            saveOptions.setCodec(com.aspose.imaging.fileformats.jpeg2000.Jpeg2000Codec.J2K);
        
            // Save to a file
            pngImage.save(dir + "output.j2k", saveOptions);
        } finally {
            pngImage.dispose();
        }
        

      • getCompressionRatios

        public int[] getCompressionRatios()

        Gets or sets the Array of compression ratio. Different compression ratios for successive layers. The rate specified for each quality level is the desired compression factor. Decreasing ratios required.

        Returns:
        The compression ratios.
      • setCompressionRatios

        public void setCompressionRatios(int[] value)

        Gets or sets the Array of compression ratio. Different compression ratios for successive layers. The rate specified for each quality level is the desired compression factor. Decreasing ratios required.

        Parameters:
        value - The compression ratios.
      • getIrreversible

        public boolean getIrreversible()

        Gets a value indicating whether use the irreversible DWT 9-7 (true) or use lossless DWT 5-3 compression (default).

        Returns:
        a value indicating whether use the irreversible DWT 9-7 (true) or use lossless DWT 5-3 compression
      • setIrreversible

        public void setIrreversible(boolean value)

        Sets a value indicating whether use the irreversible DWT 9-7 (true) or use lossless DWT 5-3 compression (default).

        Parameters:
        value - a value indicating whether use the irreversible DWT 9-7 (true) or use lossless DWT 5-3 compression
        Code example:

        This example shows how to create a PNG image and save it to JPEG2000 with the desired options.


        String dir = "c:\\temp\\";
        
        // Create a PNG image of 100x100 px.
        com.aspose.imaging.fileformats.png.PngImage pngImage = new com.aspose.imaging.fileformats.png.PngImage(100, 100);
        try {
            com.aspose.imaging.Graphics graphics = new com.aspose.imaging.Graphics(pngImage);
        
            // Fill the entire image in red.
            com.aspose.imaging.brushes.SolidBrush brush = new com.aspose.imaging.brushes.SolidBrush(com.aspose.imaging.Color.getRed());
            graphics.fillRectangle(brush, pngImage.getBounds());
        
            com.aspose.imaging.imageoptions.Jpeg2000Options saveOptions = new com.aspose.imaging.imageoptions.Jpeg2000Options();
        
            // Use the irreversible Discrete Wavelet Transform 9-7
            saveOptions.setIrreversible(true);
        
            // JP2 is the "container" format for JPEG 2000 codestreams.
            // J2K is raw compressed data, without a wrapper.
            saveOptions.setCodec(com.aspose.imaging.fileformats.jpeg2000.Jpeg2000Codec.J2K);
        
            // Save to a file
            pngImage.save(dir + "output.j2k", saveOptions);
        } finally {
            pngImage.dispose();
        }