PSD files are created to design images using different layers. Different PSD files can become huge in size owing to the visual data and layers. In such cases, you might want to compress a PSD image to reduce the file size. This article explains how to compress a PSD Photoshop file programmatically in Java.
- Java API to Compress a PSD Photoshop File – Installation
- Compress a PSD Image Programmatically in Java
Java API to Compress a PSD Photoshop File – Installation
You can work with Photoshop files programmatically in Java using Aspose.PSD for Java API. You can also compress a PSD image in Java. Quickly download the JAR files from the New Releases section or use the following Maven configurations in the pom.xml file of your application.
<repository> <id>AsposeJavaAPI</id> <name>Aspose Java API</name> <url>http://repository.aspose.com/repo/</url> </repository>
<dependency> <groupId>com.aspose</groupId> <artifactId>aspose-psd</artifactId> <version>21.7</version> <classifier>jdk16</classifier> </dependency>
Compress a PSD Image Programmatically in Java
You can compress a PSD image in Java with the following steps:
- Load the source PSD file using the PsdImage class.
- Create an object of PsdOptions class.
- Set the compression technique using the CompressionMethod class.
- Finally, save the output compressed PSD image with reduced file size.
The code snippet below shows how to compress a PSD image programmatically in Java:
Explore API Features
You may explore the documentation section to learn about many other features included in the API.
Get Free Evaluation License
You can evaluate the API in full capacity without any evaluation limitations by requesting a free temporary license.
In this article, you have checked how to compress a PSD Photoshop file programmatically in Java. Moreover, you do not need to install a Photoshop application to reduce the size of a PSD file. Furthermore, please feel free to reach out to us at the forum, in case of any concerns.