This gist explains the steps and code snippet on how to convert ODG to PSD format using Aspose.Imaging Cloud SDK for .NET.
For more information, please visit
This gist explains the steps and code snippet on how to convert ODG to PSD format using Aspose.Imaging Cloud SDK for .NET.
For more information, please visit
This Gist contains code snippets related to the conversion of ODG files to PSD format using Aspose.Imaging Cloud SDK for .NET |
// Get ClientID from https://dashboard.aspose.cloud/ | |
string clientSecret = "d757548a9f2558c39c2feebdf85b4c44"; | |
string clientID = "4db2f826-bf9c-42e7-8b2a-8cbca2d15553"; | |
// create ImagingApi instance | |
ImagingApi imagingApi= new ImagingApi( clientSecret,clientID,"https://api.aspose.cloud/"); | |
// path of input ODG image | |
string imageFile = "file-example_PDF.odg"; | |
// output file format | |
string format = "PSD"; | |
// resultant file name | |
string resultantFile = "Converted.psd"; | |
try | |
{ | |
// load the file from local drive | |
using (var file = System.IO.File.OpenRead(@"C:\Users\shahbnay\Desktop\" + imageFile)) | |
{ | |
// create FileUploadRequest instance | |
var uploadFileRequest = new UploadFileRequest(imageFile, file); | |
// Upload image to Cloud Storage | |
imagingApi.UploadFile(uploadFileRequest); | |
} | |
// Create ConvertImageRequest | |
var response = new ConvertImageRequest(imageFile, format, null, null); | |
// initiate the conversion operation | |
Stream updatedImage = imagingApi.ConvertImage(response); | |
// print success message if conversion is successful | |
if (response != null && response.Equals("OK")) | |
{ | |
Console.WriteLine("ODG successfully converted to PSD !"); | |
Console.ReadKey(); | |
} | |
// custom method to save resultant file on local system drive | |
saveToDisk(updatedImage, @"C:\Users\shahbnay\Desktop\" + resultantFile); | |
}catch (Exception ex) | |
{ | |
Console.WriteLine("error:" + ex.Message + "\n" + ex.StackTrace); | |
} | |
// custom method to save the stream as File instance | |
static void saveToDisk(Stream responseStream, String resultantFile) | |
{ | |
var fileStream = File.Create(resultantFile); | |
responseStream.Seek(0, SeekOrigin.Begin); | |
responseStream.CopyTo(fileStream); | |
fileStream.Close(); | |
} |