Manipulating Adobe Illustrator Formats
Exporting AI File to PSD
Using Aspose.PSD for Java, developers can convert Adobe Illustrator file to PSD format. This topic explains the approach to load the existing Adobe Illustrator file and convert it to PSD using PsdOptions class.
The steps to convert Adobe Illustrator file to PSD are as simple as below:
- Create an instance of the AiImage class and load image using Load method of Image class
- Create an instance of PsdOptions class
- Call AiImage.Save method with destination path and an instance of PsdOptions
Below the provided sample code demonstrates how to export Adobe Illustrator to PSD.
String dataDir = Utils.getDataDir(AIToPSD.class) + "AI/"; | |
String sourceFileName = dataDir + "34992OStroke.ai"; | |
String outFileName = dataDir + "34992OStroke.psd"; | |
try (AiImage image = (AiImage) Image.load(sourceFileName)) { | |
PsdOptions options = new PsdOptions(); | |
image.save(outFileName, options); | |
} |
Exporting AI File to JPEG
Using Aspose.PSD for Java, developers can convert Adobe Illustrator file to JPEG format. This topic explains the approach to load the existing AI file and convert it to JPEG using the JpegOptions class.
The steps to convert Adobe Illustrator file to JPEG are as simple as below:
- Create an instance of the AiImage and load image using Load method of Image class
- Create an instance of JpegOptions class
- Set image quality
- Call AiImage.save method with destination path and an instance of JpegOptions
Below provided sample code demonstrates how to export AI to JPEG.
String dataDir = Utils.getDataDir(AIToJPG.class) + "AI/"; | |
String sourceFileName = dataDir + "34992OStroke.ai"; | |
String outFileName = dataDir + "34992OStroke.jpg"; | |
try (AiImage image = (AiImage)Image.load(sourceFileName)) { | |
JpegOptions options = new JpegOptions(); | |
options.setQuality(85); | |
image.save(outFileName, options); | |
} |
Exporting AI File to GIF
Aspose.PSD for Java provides the AiImage class to load Adobe Illustrator files and the same can be used to export the Adobe Illustrator file to GIF format. This example demonstrates the usage of Aspose.PSD for Java API to export a AI file to GIF image.
String dataDir = Utils.getDataDir(AIToGIF.class) + "AI/"; | |
String sourceFileName = dataDir + "34992OStroke.ai"; | |
String outFileName = dataDir + "34992OStroke.gif"; | |
try (AiImage image = (AiImage) Image.load(sourceFileName)) { | |
GifOptions options = new GifOptions(); | |
options.setDoPaletteCorrection(false); | |
image.save(outFileName, options); | |
} |
Exporting AI File to PNG
Using Aspose.PSD for Java, developers can convert Adobe Illustrator file to PNG format. This topic explains the approach to load the existing Adobe Illustrator file and convert it to PNG using PngOptions class.
The steps to convert AI file to PNG are as simple as below:
- Create an instance of the AiImage and load the image using the Load method of Image class
- Create an instance of PngOptions class
- Set the type of color
- Call AiImage.save method with destination path and an instance of PngOptions
Below provided sample code demonstrates how to convert Adobe Illustrator to PNG.
String dataDir = Utils.getDataDir(AIToPNG.class) + "AI/"; | |
String sourceFileName = dataDir + "34992OStroke.ai"; | |
String outFileName = dataDir + "34992OStroke.png"; | |
try (AiImage image = (AiImage) Image.load(sourceFileName)) { | |
PngOptions options = new PngOptions(); | |
options.setColorType(PngColorType.TruecolorWithAlpha); | |
image.save(outFileName, options); | |
} |
Exporting AI File to TIFF
Aspose.PSD for Java provides the AiImage class to load Adobe Illustrator files and the same can be used to export the AI file to TIFF format. This example demonstrates the usage of Aspose.PSD for Java API to export Adobe Illustrator file to TIFF image.
String dataDir = Utils.getDataDir(AIToPSD.class) + "AI/"; | |
String sourceFileName = dataDir + "34992OStroke.ai"; | |
String outFileName = dataDir + "34992OStroke.tiff"; | |
try (AiImage image = (AiImage) Image.load(sourceFileName)) { | |
image.save(outFileName, new TiffOptions(TiffExpectedFormat.TiffDeflateRgba)); | |
} |
Exporting AI File to PDF
Aspose.PSD for Java provides the AiImage class to load Adobe Illustrator files and the same can be used to export the AI file to PDF format. This example demonstrates the usage of Aspose.PSD for Java API to export Adobe Illustrator file to PDF image.
String dataDir = Utils.getDataDir(AIToPDF.class) + "AI/"; | |
String sourceFileName = dataDir + "34992OStroke.ai"; | |
String outFileName = dataDir + "34992OStroke.pdf"; | |
try (AiImage image = (AiImage) Image.load(sourceFileName)) { | |
PdfOptions options = new PdfOptions(); | |
image.save(outFileName, options); | |
} |