Packages

 

com.aspose.imaging

Interfaces

Classes

Exceptions

com.aspose.imaging

Class LoadOptions

    • Constructor Detail

      • LoadOptions

        public LoadOptions()
    • Method Detail

      • getDataRecoveryMode

        public int getDataRecoveryMode()

        Gets the data recovery mode.

        Returns:
        The data recovery mode.
      • setDataRecoveryMode

        public void setDataRecoveryMode(int value)

        Sets the data recovery mode.

        Parameters:
        value - The data recovery mode.
      • getDataBackgroundColor

        public Color getDataBackgroundColor()

        Gets the Image background Color.

        Returns:
        The background color.

        Typically the background color is set whenever pixel value cannot be recovered due to data corruption.

      • setDataBackgroundColor

        public void setDataBackgroundColor(Color value)

        Sets the Image background Color.

        Parameters:
        value - The background color.

        Typically the background color is set whenever pixel value cannot be recovered due to data corruption.

      • getUseIccProfileConversion

        public boolean getUseIccProfileConversion()

        Gets a value indicating whether ICC profile conversion should be applied.

      • setUseIccProfileConversion

        public void setUseIccProfileConversion(boolean value)

        Sets a value indicating whether ICC profile conversion should be applied.

      • getBufferSizeHint

        public final int getBufferSizeHint()

        Gets the buffer size hint which is defined max allowed size for all internal buffers.

        Value: The buffer size hint, in megabytes. Non-positive value means no memory limitation for internal buffers
        Returns:
        the buffer size hint which is defined max allowed size for all internal buffers.
      • setBufferSizeHint

        public final void setBufferSizeHint(int value)

        Sets the buffer size hint which is defined max allowed size for all internal buffers.

        Value: The buffer size hint, in megabytes. Non-positive value means no memory limitation for internal buffers
        Parameters:
        value - the buffer size hint which is defined max allowed size for all internal buffers.
        Code example:

        The following example shows how to set a memory limit when loading a JPEG image. The memory limit is the maximum allowed size (in megabytes) for all internal buffers.


        String workDir = "c:\\temp\\";
        // Setting a memory limit of 50 megabytes for target loaded image
        com.aspose.imaging.LoadOptions loadOptions = new com.aspose.imaging.LoadOptions();
        loadOptions.setBufferSizeHint(50);
        com.aspose.imaging.Image image = com.aspose.imaging.Image.load(workDir + "inputFile.jpg", loadOptions);
        try {
            com.aspose.imaging.imageoptions.JpegOptions jpegOptions = new com.aspose.imaging.imageoptions.JpegOptions();
            jpegOptions.setCompressionType(com.aspose.imaging.fileformats.jpeg.JpegCompressionMode.Baseline);
            jpegOptions.setQuality(100);
            image.save(workDir + "outputFile_Baseline.jpg", jpegOptions);
        
            jpegOptions = new com.aspose.imaging.imageoptions.JpegOptions();
            jpegOptions.setCompressionType(com.aspose.imaging.fileformats.jpeg.JpegCompressionMode.Progressive);
            image.save(workDir + "outputFile_Progressive.jpg", jpegOptions);
        
            jpegOptions = new com.aspose.imaging.imageoptions.JpegOptions();
            jpegOptions.setCompressionType(com.aspose.imaging.fileformats.jpeg.JpegCompressionMode.Lossless);
            jpegOptions.setColorType(com.aspose.imaging.fileformats.jpeg.JpegCompressionColorMode.YCbCr);
            jpegOptions.setBitsPerChannel((byte) 4);
            image.save(workDir + "outputFile_Lossless.jpg", jpegOptions);
        
            jpegOptions = new com.aspose.imaging.imageoptions.JpegOptions();
            jpegOptions.setCompressionType(com.aspose.imaging.fileformats.jpeg.JpegCompressionMode.JpegLs);
            jpegOptions.setJpegLsInterleaveMode(com.aspose.imaging.fileformats.jpeg.JpegLsInterleaveMode.None);
            jpegOptions.setJpegLsAllowedLossyError(3);
            jpegOptions.setJpegLsPreset(null);
            image.save(workDir + "outputFile_JpegLs.jpg", jpegOptions);
        } finally {
            image.close();
        }
        

      • getProgressEventHandler

        public ProgressEventHandler getProgressEventHandler()

        Gets the progress event handler.

        Value: The progress event handler.
        Specified by:
        getProgressEventHandler in interface com.aspose.internal.progressmanagement.IProgressEventHandler
        Returns:
        the progress event handler.
      • setProgressEventHandler

        public void setProgressEventHandler(ProgressEventHandler value)

        Sets the progress event handler.

        Parameters:
        value - the progress event handler.
        Code example:

        The following example shows how to print information about progress events for load/export operations.


        String dir = "c:\\aspose.imaging\\java\\issues\\1440\\";
        String fileName = dir + "big.png";
        
        // Example of use of separate operation progress event handlers for load/export operations
        final com.aspose.imaging.ProgressEventHandler loadHandler = new com.aspose.imaging.ProgressEventHandler() {
            @Override
            public void invoke(com.aspose.imaging.progressmanagement.ProgressEventHandlerInfo info) {
                System.out.format("Load event %s : %d/%d\n", com.aspose.imaging.progressmanagement.EventType.toString(com.aspose.imaging.progressmanagement.EventType.class, info.getEventType()), info.getValue(), info.getMaxValue());
            }
        };
        
        final com.aspose.imaging.ProgressEventHandler exportHandler = new com.aspose.imaging.ProgressEventHandler() {
            @Override
            public void invoke(com.aspose.imaging.progressmanagement.ProgressEventHandlerInfo info) {
                System.out.format("Export event %s : %d/%d\n", com.aspose.imaging.progressmanagement.EventType.toString(com.aspose.imaging.progressmanagement.EventType.class, info.getEventType()), info.getValue(), info.getMaxValue());
            }
        };
        
        com.aspose.imaging.Image image = com.aspose.imaging.Image.load(fileName, new com.aspose.imaging.LoadOptions() {{ setProgressEventHandler(loadHandler); }} );
        try {
            image.save(fileName + ".psd",
                    new com.aspose.imaging.imageoptions.PsdOptions() {{ setProgressEventHandler( exportHandler); }});
        }
        finally {
            image.close();
        }
        
        // The STDOUT log may look like this:
        //        Load event Initialization : 1/4
        //        Load event PreProcessing : 2/4
        //        Load event Processing : 3/4
        //        Load event Finalization : 4/4
        //        Export event Initialization : 1/4
        //        Export event PreProcessing : 2/4
        //        Export event Processing : 3/4
        //        Export event RelativeProgress : 1/1
        //        Load event RelativeProgress : 1/1
        //        Export event Finalization : 4/4