Hi Support,
I’m getting System.IndexOutOfRangeException when saving PSD file after editing.
Below is the code:
public ActionResult Update_Color(string unit)
{
using (var im = (PsdImage)Aspose.PSD.Image.Load(FilePath.GetDataDir_PSD(), new PsdLoadOptions()))
{
foreach (var layer in im.Layers)
{
if (layer.Name == unit)
{
var fillLayer = layer as FillLayer;
if (fillLayer != null)
{
var settings = fillLayer.FillSettings as IColorFillSettings;
if (settings != null)
{
settings.Color = Aspose.PSD.Color.FromName(“Red”);
fillLayer.Update();
break;
}
}
}
}
im.Save(FilePath.GetDataDir_PSD_Updated(), true);
im.Dispose();
}
FileInfo file = new FileInfo(FilePath.GetDataDir_PSD_Updated());
file.CopyTo(FilePath.GetDataDir_PSD(),true);
return Content(unit + " updated successfully!");
}
I’m getting error on im.Save(FilePath.GetDataDir_PSD_Updated(), true);
Below is the screenshot of exception:
image.png (13.0 KB)