PNG is short for Portable Network Graphic, and is a type of raster image based on bitmap format, and is widely used on websites to display high-quality digital images. The PNGs offer not just lossless compression, but also a much broader and brighter color palette. Furthermore, the PNG file format is widely used on websites to display high-quality digital images. Furthermore, PNGs offer not just lossless compression, but also a much broader and brighter color palette. However once we have a PNG image, we cannot directly edit it but on the other end, if we have PSD file, it gets pretty easy to edit these images. Also, we understand that PSD files are the native file format of Adobe Photoshop and have .psd extension. So in this article, we are going to discuss the details on How To convert PNG to PSD on Mobile or PC.
PSD to PNG Conversion API
In order to programmatically convert one image to another image format, Aspose.Imaging Cloud SDK for Java is one amazing solution. You get the option to programmatically edit, manipulate and transform raster, metafiles, photoshop to variety of Supported Formats. Furthermore, apart from conversion capabilities, you may also edit the image files within your favorite programming language. This SDK is capable of converting PDF to PNG as well as PNG to PSD online. So with simple code snippets, you can easily perform PNG to PSD conversion. 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 PNG to PSD in Java
As we know that the API is capable of performing inter format conversions, so in this section, we are going to discuss the details on how to convert PNG to PSD using Java code snippet.
- First of all, create an object of ImagingApi using personalized client credentials
- Secondly, load PNG file using readAllBytes(…) method and pass to byte array
- Thirdly, create an instance of UploadFileRequest which takes PNG name and upload to cloud storage using uploadFile(…) method
- Now create an object of ConvertImageRequest which takes input PNG name and resultant format as PSD
- Call the method convertImage(…) to convert PNG to PSD format and result is returned as response stream
- Finally, save the resultant PSD to local drive using FileOutputStream object
PNG to PSD using cURL Commands
Our REST APIs can easily be accessed via cURL commands through command line terminal. So in this section, we are going to explore the details on how to perform PNG to PSD conversion using cURL commands. Now 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"
After the JWT generation, please execute the following command to convert PNG to PSD format.
curl -v -X GET "https://api.aspose.cloud/v3.0/imaging/input.png/convert?format=psd" \ -H "accept: application/json" \ -H "authorization: Bearer <JWT Token>" \ -o Converted.psd
By the end of this article, we have explored the details on how we can convert PNG to PSD using Java code snippet. Similarly, we have also explored an option to convert PNG to PSD 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: