Packages

 

com.aspose.imaging.imageloadoptions

Class PngLoadOptions

  • All Implemented Interfaces:
    com.aspose.internal.progressmanagement.IProgressEventHandler

    Deprecated. 
    Should be replaced with base "LoadOptions" class because it contains ony one obsolete "StrictMode" property.

    @Deprecated
    public class PngLoadOptions
    extends LoadOptions

    The png load options.

    • Constructor Detail

      • PngLoadOptions

        public PngLoadOptions()
        Deprecated. 

        Initializes a new instance of the PngLoadOptions class.

    • Method Detail

      • getStrictMode

        @Deprecated
        public boolean getStrictMode()
        Deprecated. This redundant property should be replaced with an expression: "LoadOptions.DataRecoveryMode == DataRecoveryMode.ConsistentRecover".

        Gets or sets a value indicating whether [strict mode].

        Returns:
        a value indicating whether [strict mode].
      • setStrictMode

        @Deprecated
        public void setStrictMode(boolean value)
        Deprecated. This redundant property should be replaced with an expression: "LoadOptions.DataRecoveryMode == DataRecoveryMode.ConsistentRecover".

        Gets or sets a value indicating whether [strict mode].

        Parameters:
        value - a value indicating whether [strict mode].
        Code example:

        The following example shows how to read PNG file : a strict mode. The strict mode allows to find potential problems : PNG images, e.g. unrecognized data blocks, unexpected end of file. Such files still can be opened : default (non-strict) mode by Aspose.Imaging and by common viewers as well. However any attempts to open them : the strict mode cause a corresponding exception.


        String dir = "c:\\aspose.imaging\\java\\issues\\1442\\";
        String inputImage = dir + "FC5F1998104EB92469CB14070628073616BB28F9.png";
        String outputImage = inputImage + ".png";
        
        // Default mode (non-strict) - successful reading.
        com.aspose.imaging.Image image = com.aspose.imaging.Image.load(inputImage);
        try {
            image.save(outputImage, new com.aspose.imaging.imageoptions.PngOptions());
        }
        finally {
            image.close();
        }
        
        // Strict mode - ImageLoadException : Unexpected end of file.
        com.aspose.imaging.Image image2 = com.aspose.imaging.Image.load(inputImage, new com.aspose.imaging.imageloadoptions.PngLoadOptions() {{
            setStrictMode(true);
            }});
                        
        try {
            image2.save(outputImage, new com.aspose.imaging.imageoptions.PngOptions());
        }
        finally {
            image2.close();
        }