Convert cmx to jpg
Contents
[
Hide
]
Convert cmx to jpg
Using Aspose.Imaging for Java, developers can convert CMX files to Jpg images. This topic explains the approach to load existing CMX file and convert it to Jpg.
The following code snippet shows you how to convert CMX files to Jpg.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import com.aspose.imaging.*; | |
import com.aspose.imaging.imageoptions.PdfOptions; | |
import com.aspose.imaging.imageoptions.VectorRasterizationOptions; | |
try (com.aspose.imaging.fileformats.cmx.CmxImage image = | |
(com.aspose.imaging.fileformats.cmx.CmxImage)Image.load("input.cmx")) | |
{ | |
com.aspose.imaging.imageoptions.PdfOptions options = new PdfOptions(); | |
options.setPdfDocumentInfo(new com.aspose.imaging.fileformats.pdf.PdfDocumentInfo()); | |
// Set rasterization options for fileformat | |
VectorRasterizationOptions rasterizationOptions = (VectorRasterizationOptions) image.getDefaultOptions(new Object[]{Color.getWhite(), image.getWidth(), image.getHeight()}); | |
options.setVectorRasterizationOptions(rasterizationOptions); | |
rasterizationOptions.setTextRenderingHint(TextRenderingHint.SingleBitPerPixel); | |
rasterizationOptions.setSmoothingMode(SmoothingMode.None); | |
image.save("output.pdf", options); | |
} |