You can read all the details at: Convert PNG or JPG Image to PSD Programmatically using C#
Last active
December 23, 2021 07:13
-
-
Save aspose-com-gists/f4f1d5f10b7991a2c22e628dc19c5735 to your computer and use it in GitHub Desktop.
C# Convert PNG or JPG Image to PSD Programmatically in .NET
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
string fileName = "Sample.jpg"; | |
// Initialize PsdImage class object | |
PsdImage image = new PsdImage(900, 700); | |
// Load input image into FileStream object | |
Stream stream = new FileStream(fileName, FileMode.Open); | |
Layer layer = null; | |
try | |
{ | |
layer = new Layer(stream); | |
// Add input image as layer to PSD image | |
image.AddLayer(layer); | |
} | |
catch (Exception e) | |
{ | |
if (layer != null) | |
{ | |
layer.Dispose(); | |
} | |
throw e; | |
} | |
// Convert JPG image to output PSD file | |
image.Save("JPGtoPSD.psd"); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
string fileName = "Sample.png"; | |
// Initialize PsdImage class object | |
PsdImage image = new PsdImage(900, 700); | |
// Load input image into FileStream object | |
Stream stream = new FileStream(fileName, FileMode.Open); | |
Layer layer = null; | |
try | |
{ | |
layer = new Layer(stream); | |
// Add input image as layer to PSD image | |
image.AddLayer(layer); | |
} | |
catch (Exception e) | |
{ | |
if (layer != null) | |
{ | |
layer.Dispose(); | |
} | |
throw e; | |
} | |
// Convert PNG image to output PSD file | |
image.Save("PNGtoPSD.psd"); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment