Packages

 

com.aspose.imaging.imageoptions

Class MetafileOptions

  • All Implemented Interfaces:
    com.aspose.fileformats.core.imageoptions.ICompressOptions, com.aspose.ms.System.IDisposable, Closeable, AutoCloseable
    Direct Known Subclasses:
    EmfOptions, WmfOptions


    public abstract class MetafileOptions
    extends ImageOptionsBase
    implements com.aspose.fileformats.core.imageoptions.ICompressOptions

    The Metafiles base options.

    • Method Detail

      • getCompress

        public final boolean getCompress()

        Gets a value indicating whether this ##Aspose#FileFormats#Core#ImageOptions is compressed.

        Value: true if compressed; otherwise, false.
        Specified by:
        getCompress in interface com.aspose.fileformats.core.imageoptions.ICompressOptions
        Returns:
        a value indicating whether this ##Aspose#FileFormats#Core#ImageOptions is compressed.
      • setCompress

        public final void setCompress(boolean value)

        Sets a value indicating whether this ##Aspose#FileFormats#Core#ImageOptions is compressed.

        Value: true if compressed; otherwise, false.
        Specified by:
        setCompress in interface com.aspose.fileformats.core.imageoptions.ICompressOptions
        Parameters:
        value - a value indicating whether this ##Aspose#FileFormats#Core#ImageOptions is compressed.
        Code example:

        The following example shows how to convert a emf images to emz format


        String file = "input.emf";
        String baseFolder = "D:\\Compressed\\";
        String inputFile = baseFolder + file;
        String outFile = inputFile + ".emz";
        try (com.aspose.imaging.Image image = com.aspose.imaging.Image.load(inputFile))
        {
            com.aspose.imaging.imageoptions.VectorRasterizationOptions vectorRasterizationOptions = new com.aspose.imaging.imageoptions.EmfRasterizationOptions();
            vectorRasterizationOptions.setPageSize(com.aspose.imaging.Size.to_SizeF(image.getSize()));
            com.aspose.imaging.imageoptions.EmfOptions options = new com.aspose.imaging.imageoptions.EmfOptions();
            options.setVectorRasterizationOptions(vectorRasterizationOptions);
            options.setCompress(true);
            image.save(outFile, options);
        }