var newLayer = new Aspose.PSD.FileFormats.Psd.Layers.Layer(fs);
newLayer.DisplayName = “NewLayer”;
im.AddLayer(newLayer);
im.Save(@“D:\tong\MyProject\Psd\newPsd.psd”, true);
希望在现有psd上 追加一个layer 里面有一张5M左右的jpg 但一直会报 没有足够的内存继续执行程序
Aspose.PSD 版本为21.4.0
var im = (PsdImage)Image.Load(@"D:\tong\MyProject\Psd\001-.psd");
var imagePath = @"D:\tong\MyProject\Psd\T_0003.jpg ";
FileStream fs = new FileStream(imagePath, FileMode.Open);
using (im)
var newLayer = new Aspose.PSD.FileFormats.Psd.Layers.Layer(fs);
newLayer.DisplayName = "NewLayer";
im.AddLayer(newLayer);
im.Save(@"D:\tong\MyProject\Psd\newPsd.psd", true);
Psd.zip (6.7 MB)