Hi, creating a new smart object layer using a JPEG with large dimensions will result in System.OverflowException: ‘Arithmetic operation resulted in an overflow.’:
using (var image = (PsdImage)Image.Load("source.psd", new PsdLoadOptions { DataRecoveryMode = DataRecoveryMode.MaximalRecover }))
{
using (var stream = new FileStream("test.jpg", FileMode.Open))
{
var addedLayer = new SmartObjectLayer(stream);
addedLayer.Name = "Test Layer";
image.AddLayer(addedLayer);
}
}
AsposeDemo.zip (2.5 MB)
Exception details:
System.OverflowException
HResult=0x80131516
Message=Arithmetic operation resulted in an overflow.
Source=Aspose.PSD
StackTrace:
at Aspose.PSD.FileFormats.Psd.Layers.SmartObjects.SmartObjectLayer.(RasterImage , ResolutionSetting , Boolean )
at Aspose.PSD.FileFormats.Psd.Layers.SmartObjects.SmartObjectLayer.(Image , ResolutionSetting , Boolean )
at Aspose.PSD.FileFormats.Psd.Layers.SmartObjects.SmartObjectLayer.(Image , ResolutionSetting , Boolean )
at Aspose.PSD.FileFormats.Psd.Layers.SmartObjects.SmartObjectLayer.ReplaceContents(Image image, ResolutionSetting resolution)
at Aspose.PSD.FileFormats.Psd.Layers.SmartObjects.SmartObjectLayer.ReplaceContents(Image image)
at Aspose.PSD.FileFormats.Psd.Layers.SmartObjects.SmartObjectLayer..ctor(Stream stream)
at AsposeDemo.Program.Main(String[] args) in D:\Code\AsposeDemo\Program.cs:line 23