Adobe Photoshop’s PSD format is ideal for preserving layers and editing capabilities, but it’s not always the most practical for sharing, displaying on the web, or integrating into various applications. That’s where the importance of converting PSD to PNG comes into play. PNG (Portable Network Graphics) is a widely supported format known for its lossless compression and support for transparency, making it perfect for web usage, digital sharing, and integration into diverse projects.
REST API to Export PSD to PNG
With Aspose.Imaging Cloud SDK for .NET, the conversion of PSD to PNG becomes a streamlined and efficient process. This powerful SDK offers a range of features tailored to simplify image conversion tasks, ensuring high-quality results. You can seamlessly integrate the SDK into your applications and leverage its intuitive APIs to perform PSD to PNG conversion with ease. Whether you’re working with single-layer PSD files or complex multi-layer compositions, Aspose.Imaging Cloud SDK for .NET handles the conversion process seamlessly, preserving image quality and transparency.
Firstly, we need to search Aspose.Imaging-Cloud
in NuGet packages manager and click the Add Package
button. This will add the SDK reference in your project. The next important step is to obtain your client credentials from cloud dashboard. If you do not have an existing account, simply create a free account by following the instructions specified in the quick start article.
Change PSD to PNG in C# .NET
In this section, we are going to explore the details on how Aspose.Imaging Cloud SDK for .NET empowers you to efficiently convert PSD to PNG and optimize the image processing workflows with confidence using C# .NET.
ImagingApi imagingApi = new ImagingApi(clientSecret, clientID, baseUrl: "https://api.aspose.cloud");
Create an instance of ImagingApi class where we pass client credentials and baseURL as arguments.
imagingApi.UploadFile(new UploadFileRequest("input.psd", imageStream));
Upload the input PSD image to cloud storage.
ConvertImageRequest requestInstance = new ConvertImageRequest("input.psd", "png");
Create an instance of ConvertImageRequest class where pass the name of input PSD image and resultant format as PNG
.
var resultant = imagingApi.ConvertImage(requestInstance);
Call the API to save PSD to PNG format. The output is returned in stream format.
saveToDisk(resultant, "Resultant.png");
Our custom method to save the PNG image to local drive.
The sample PSD used in the above example can be downloaded from FilterEffectSampleImage.psd and the resultant PDF from resultant.png.
Convert PSD to PNG using cURL Commands
As an alternative, you can change PSD to PNG using Aspose.Imaging Cloud and cURL commands as it offers a straightforward and scriptable solution, when you are seeking to automate image conversion tasks. With just a few simple commands, you can initiate the PSD to PNG conversion process where we specify the input PSD file, and receive the resulting PNG output. This approach allows for seamless integration into existing workflows and automation pipelines, enabling efficient batch processing of PSD files.
The first step is to generate a JWT access token using the following command:
curl -v "https://api.aspose.cloud/connect/token" \
-X POST \
-d "grant_type=client_credentials&client_id=163c02a1-fcaa-4f79-be54-33012487e783&client_secret=c71cfe618cc6c0944f8f96bdef9813ac" \
-H "Content-Type: application/x-www-form-urlencoded" \
-H "Accept: application/json"
The next step is to execute the following command to save Photoshop as PNG and save the output on local drive.
curl -v "https://api.aspose.cloud/v3.0/imaging/{sourceImage}/convert?format=png" \
-X GET \
-H "accept: application/json" \
-H "authorization: Bearer {accessToken}" \
-o "resultant.png"
Replace sourceImage
with the name of input PSD file available in cloud storage, and accessToken
with JWT access token generated above.
Conclusion
In conclusion, we have learned that Aspose.Imaging Cloud ensures high-quality conversion results, preserving image quality, transparency, and other important attributes during the PSD to PNG transformation process. So, whether you choose to utilize Aspose.Imaging Cloud SDK for .NET or integrate Aspose.Imaging Cloud with cURL commands, both approaches offer versatile solutions for automating image conversion tasks, empowering you to effortlessly bridge the gap between Photoshop PSD format and the widely supported PNG format. We highly encourage you to leverage our API for PSD to PNG conversion operations and unlock the full potential of their image processing workflows.
Useful Links
Related Articles
We highly recommend visiting the following blog posts for information on: