We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Error while saving PSD file into png format

I try to load PSD and save it as PNG, but it thows “Image saving failed.” and its inner exception as “Object reference not set to an instance of an object.”. I have attached code and PSD file for reference.

Do you know why this error happening?

using (PsdImage image = (PsdImage)Image.Load(@“C:\temp\photooverlay_5_new.psd”))
PsdImage psdImage = image;
var pngOptions = new PngOptions();
pngOptions.ColorType = PngColorType.TruecolorWithAlpha;
psdImage.Save(@“c:\temp\asposeImage.png”, new Aspose.Imaging.ImageOptions.PngOptions());

Stack Trace:
at Aspose.Imaging.Image.Save(Stream stream, ImageOptionsBase optionsBase, Rectangle boundsRectangle)
at Aspose.Imaging.Image.Save(String filePath, ImageOptionsBase options, Rectangle boundsRectangle)

Hi Sarvan Kumar,

Thanks for inquiring Aspose.Imaging.

I have worked with sample code PSD file shared by you using Aspose.Imaging for .NET 17.4 on my end. I have not been able to observe the issue on my end and for your kind reference, the generated output is also attached. Can you please try using specified version on your end.

Many Thanks,

Hi i am also using .Net 17.4 version assembly. i have attached the .Net console application.

Can you please verify. Does it need any dependency?

Hi Sarvan Kumar,

I have worked with sample project shared by you. Actually, you are missing Aspose.Imaging license reference in your application. You need to set license in your application and then there will be no exception while saving. Please visit these guidelines for getting temporary license. Once you avail the license, you can set that in your application by following Licensing guidelines.

Many Thanks,