You may have seen files with the .psd extension, especially if you’ve been an Adobe Photoshop user. Furthermore, its most commonly used by designers and artists because Photoshop documents are powerful tools for image data storage and creation. It’s a native file format of Adobe Photoshop and you may try using programs like Adobe Illustrator or Inkscape to open these files. However, when sharing such files over the internet, not every user has these programs installed/configured because they are commercial softwares. Furthermore, we cannot display PSD file within web-browser so in this article, we are going to discuss the details on How To View PSD Files Without Photoshop On Mobile Or A PC by converting PSD to JPG format.
PSD to JPG Conversion API
For conversion of PSD to JPG format, we are going to use Aspose.Imaging Cloud SDK for Java that enables to implement image processing and conversion capabilities within Java application. So with the help of this SDK, you get the capabilities to programmatically edit, manipulate and transform raster, metafiles, photoshop to variety of Supported Formats. Now in order to get started with SDK utilization, we need to add its reference in our java project by including following information in pom.xml (maven build type project).
<repositories> <repository> <id>aspose-cloud</id> <name>artifact.aspose-cloud-releases</name> <url>http://artifact.aspose.cloud/repo</url> </repository> </repositories> <dependencies> <dependency> <groupId>com.aspose</groupId> <artifactId>aspose-imaging-cloud</artifactId> <version>22.4</version> </dependency> </dependencies>
Convert PSD to JPG in Java
In this section, we are going to discuss the details on how to convert photoshop to JPG using Java code snippet.
- First of all, create an object of ImagingApi using personalized client credentials
- Secondly, read the PSD file using readAllBytes(…) method and pass to byte array
- Thirdly, create an instance of UploadFileRequest where we pass input PSD name and upload to cloud storage using uploadFile(…) method
- Now create an object of ConvertImageRequest where we specify input PSD and resultant format jpg
- Call the method convertImage(…) to convert PSD to PNG format and result is returned as response stream
- Finally, save the resultant JPG to local drive using FileOutputStream object
The sample PSD image used in above example can be downloaded from FilterEffectSampleImage.psd.
Convert Photoshop to JPG using cURL Commands
The Aspose.Imaging Cloud is developed according to REST architecture, so we can easily access the API via command line terminal on any platform and fulfill our requirements. So as a pre-requisite, first we need to generate a JWT access token (based on client credentials) using following command.
curl -v "https://api.aspose.cloud/connect/token" \ -X POST \ -d "grant_type=client_credentials&client_id=bb959721-5780-4be6-be35-ff5c3a6aa4a2&client_secret=4d84d5f6584160cbd91dba1fe145db14" \ -H "Content-Type: application/x-www-form-urlencoded" \ -H "Accept: application/json"
Once the JWT token is generation, please execute the following command to convert photoshop to jpg format.
curl -v -X GET "https://api.aspose.cloud/v3.0/imaging/source.psd/convert?format=jpg" \ -H "accept: application/json" \ -H "authorization: Bearer <JWT Token>" \ -o Resultant.jpg
This article has provided some amazing details on how we can convert PSD to JPG using Java code snippet. Similarly, we have also explored an option to convert photoshop to JPEG using cURL commands via command line terminal. The features of API can easily be tested using SwaggerUI within a web browser. Please note that the complete source code of Cloud SDK is available on GitHub (under MIT license), so you may consider downloading and modifying it as per your convenience.
Nevertheless, the Product Documentation is an amazing source of information to learn about other exciting features offered by the API Lastly, in case you encoutner any issues while using the API, you may consider approaching us for a quick resolution via free product support forum.
Please visit the following links to learn more about: