Out of Memory Error When Saving PSD File After Editing

Hi Support,

I am writing to seek assistance with an issue I am encountering while working with PSD files using the Aspose.PSD library.

When attempting to save a PSD file after editing its layers, I am encountering an “Out of Memory” error. This occurs specifically at the line where I call the Save method on the PsdImage object.

Below is the code:

            using (var im = (PsdImage)Aspose.PSD.Image.Load(fileName, new PsdLoadOptions()))
            {
                foreach (var layer in im.Layers)
                {
                    if (layer.Name != "Layer 1")
                    {
                        var fillLayer = layer as FillLayer;
                        if (fillLayer != null)
                        {
                            var settings = fillLayer.FillSettings as IColorFillSettings;
                            if (settings != null)
                            {
                                settings.Color = Aspose.PSD.Color.FromName("White");
                                fillLayer.Update();
                                break;
                            }
                        }
                        unitModel.Add(new UnitMaster { UnitNo = layer.Name, StatusID = 1, BlockID = BlockID });
                    }
                }
                
                im.Save(fileName, true);
            }

Below is the screenshot of error
image.png (18.4 KB)

Any assistance or insights you can provide to help resolve this issue would be greatly appreciated.

@Abdul_Ahad i can’t reproduce issue with my PSD file and your code, provide please your source file.

You can get the source code from below repo

@Abdul_Ahad
We have opened the following new ticket(s) in our internal issue tracking system and will deliver their fixes according to the terms mentioned in Free Support Policies.

Issue ID(s): PSDNET-1925

You can obtain Paid Support Services if you need support on a priority basis, along with the direct access to our Paid Support management team.

@Abdul_Ahad I checked your file and code and get save result after 20-30 min, on different systems.
Can you give more information about your platform, framework, RAM, and time to error in your case?