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

Free Support Forum - aspose.com

Convert psd to jpg error

code:

using (Aspose.Imaging.Image image = Aspose.Imaging.Image.Load(filePath))
{
var ops = new Aspose.Imaging.ImageOptions.BmpOptions();
image.Save(@“C:\output.jpeg”, ops);
}

error:
Aspose.Imaging.CoreExceptions.ImageSaveException: Image saving failed. —> Aspose.Imaging.CoreExceptions.ImageSaveException: Image export failed. —> System.NullReferenceException: 未将对象引用设置到对象的实例。
在 ..Process(Rectangle , Int32[] , Point , Point )
在 Aspose.Imaging.RasterImage..Process(Rectangle , Int32[] , Point , Point )
在 ..(Rectangle , IPartialArgb32PixelLoader )
在 ..LoadPartialArgb32Pixels(Rectangle , IPartialArgb32PixelLoader )
在 Aspose.Imaging.RasterImage.. (Rectangle )
在 .( , IList1 )</div><div> 在 .(Rectangle , , , Int32 , Int32 )</div><div> 在 Aspose.Imaging.RasterImage.(Rectangle , Int32[] , Boolean , IPartialArgb32PixelLoader )</div><div> 在 Aspose.Imaging.RasterImage.(Rectangle , Boolean , IPartialArgb32PixelLoader )</div><div> 在 Aspose.Imaging.RasterImage.LoadPartialArgb32Pixels(Rectangle desiredRectangle, IPartialArgb32PixelLoader pixelLoader)</div><div> 在 .(RasterImage , Rectangle , IPartialArgb32PixelLoader )</div><div> 在 Aspose.Imaging.Graphics.. (Rectangle )</div><div> 在 .( , IList1 )
在 .(Rectangle , , , Int32 , Int32 )
在 Aspose.Imaging.Graphics.( )
在 Aspose.Imaging.Graphics.FillRectangle(Brush brush, RectangleF rect)
在 Aspose.Imaging.Graphics.FillRectangle(Brush brush, Rectangle rect)
在 ..Process(Rectangle , Int32[] , Point , Point )
在 .. (Rectangle )
在 .( , IList1 )</div><div> 在 .(Rectangle , , , Int32 , Int32 )</div><div> 在 ..LoadPartialArgb32Pixels(Rectangle , IPartialArgb32PixelLoader )</div><div> 在 Aspose.Imaging.RasterImage.. (Rectangle )</div><div> 在 .( , IList1 )
在 .(Rectangle , , , Int32 , Int32 )
在 Aspose.Imaging.RasterImage.(Rectangle , Int32[] , Boolean , IPartialArgb32PixelLoader )
在 Aspose.Imaging.RasterImage.(Rectangle , Boolean , IPartialArgb32PixelLoader )
在 Aspose.Imaging.RasterImage.LoadPartialArgb32Pixels(Rectangle desiredRectangle, IPartialArgb32PixelLoader pixelLoader)
在 Aspose.Imaging.FileFormats.Bmp.BmpImage.. (Rectangle )
在 .( , IList`1 )
在 .(Rectangle , , , Int32 , Int32 )
在 Aspose.Imaging.FileFormats.Bmp.BmpImage.(RasterImage , StreamContainer , , IColorPalette , Rectangle )
在 .Export(Image , Stream , ImageOptionsBase , Rectangle )
在 Aspose.Imaging.Image.Save(Stream stream, ImageOptionsBase optionsBase, Rectangle boundsRectangle)
— 内部异常堆栈跟踪的结尾 —
在 Aspose.Imaging.Image.Save(Stream stream, ImageOptionsBase optionsBase, Rectangle boundsRectangle)
在 Aspose.Imaging.Image.Save(String filePath, ImageOptionsBase options, Rectangle boundsRectangle)
— 内部异常堆栈跟踪的结尾 —
在 Aspose.Imaging.Image.Save(String filePath, ImageOptionsBase options, Rectangle boundsRectangle)
在 Aspose.Imaging.Image.Save(String filePath, ImageOptionsBase options)
在 Tests.AsposePdfConverter.CadConvert(String filePath, String md5) 位置 E:\projects\Tests\Tests\AsposeConvert.cs:行号 102
在 Tests.Form1.psd2jpg_Click(Object sender, EventArgs e) 位置 E:\projects\Tests\Tests\Form1.cs:行号 66
在 System.Windows.Forms.Control.OnClick(EventArgs e)
在 System.Windows.Forms.Button.OnClick(EventArgs e)
在 System.Windows.Forms.Button.OnMouseUp(MouseEventArgs mevent)
在 System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks)
在 System.Windows.Forms.Control.WndProc(Message& m)
在 System.Windows.Forms.ButtonBase.WndProc(Message& m)
在 System.Windows.Forms.Button.WndProc(Message& m)
在 System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
在 System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
在 System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)



can you try JpegOptions instead of BmpOptions?


new Aspose.Imaging.ImageOptions.JpegOptions

Hi,

Thank you for your inquiry.

This is to update you that you can convert PSD layers to raster image formats. PSD file itself cannot directly be converted to raster image formats. Please visit the following URLs for details. Feel free to contact us in case of any query or comments along with sample input file and sample code snippet that you are using at your end.