Unable to save unchanged PSD

Hi!
The attached file is a simplification of an actual file we are trying to edit using Aspose.PSD v25.4.0
Even with no changes, I’m not being able to save the PSD file back to disk.
I’m running the following code:

            var loadOptions = new PsdLoadOptions();
            loadOptions.LoadEffectsResource = true;
            using (PsdImage image = (PsdImage)Image.Load(@opt.Psd, loadOptions))
            {

                image.Save(opt.Output);
            }

throws the following:

Exception has occurred: CLR/System.ArgumentException
Exception thrown: 'System.ArgumentException' in Aspose.PSD.dll: 'The rectangle has no common processing area. Cannot proceed.'
   at Aspose.PSD.Image.GetFittingRectangle(Rectangle rectangle, Int32 width, Int32 height)
   at Aspose.PSD.Image.GetFittingRectangle(Rectangle rectangle, Int32[] pixels, Int32 width, Int32 height)
   at .(Rectangle , Int32[] )
   at .SaveArgb32Pixels(Rectangle , Int32[] )
   at .SavePixelsInternal(Rectangle , Int32[] )
   at Aspose.PSD.RasterImage..(RasterImage , Rectangle , Int32[] )
   at Aspose.PSD.RasterImage.(Rectangle , Int32[] )
   at Aspose.PSD.RasterImage.SaveArgb32Pixels(Rectangle rectangle, Int32[] pixels)
   at e.e(Rectangle )
   at .(Int32[] , Lfx2Resource , Rectangle , Point , Point , Layer )
   at .(Int32[] , Lfx2Resource , Rectangle , Point , Point , Layer )
   at .(Int32[] , Rectangle , Point , Point , Layer )
   at .(Rectangle , Int32[] , Point , Point )
   at .Process(Rectangle , Int32[] , Point , Point )
   at .(Rectangle )
   at .Process(Rectangle , Int32[] , Point , Point )
   at .Process(Rectangle , Int32[] , Point , Point )
   at .LoadPartialArgb32Pixels(Rectangle , IPartialArgb32PixelLoader )
   at .e(Rectangle )
   at .(e , IList`1 ,  )
   at .(Rectangle , e ,  , Int32 , Int32 ,  )
   at .(Rectangle , e ,  )
   at .(Rectangle , RasterImage , Point , Point )
   at .(Rectangle , RasterImage , Point , Point )
   at ..(Int32 ,  , RasterImage , Rectangle , Point , Point )
   at ..Process(Rectangle , Int32[] , Point , Point )
   at ..(LayerGroup , RasterImage , Rectangle )
   at ..Process(Rectangle , Int32[] , Point , Point )
   at ..e(Rectangle )
   at .(e , IList`1 ,  )
   at ..LoadPartialArgb32Pixels(Rectangle , IPartialArgb32PixelLoader )
   at .e(Rectangle )
   at .(e , IList`1 ,  )
   at .(Rectangle , e ,  , Int32 , Int32 ,  )
   at .(Rectangle , e ,  )
   at e.e(Rectangle , IPartialArgb32PixelLoader )
   at Aspose.PSD.RasterImage.(Rectangle , IPartialArgb32PixelLoader )
   at Aspose.PSD.RasterImage.LoadPartialArgb32Pixels(Rectangle rectangle, IPartialArgb32PixelLoader partialPixelLoader)
   at Aspose.PSD.FileFormats.Psd.PsdImage.(StreamContainer , e )
   at Aspose.PSD.FileFormats.Psd.PsdImage.SaveData(Stream stream)
   at Aspose.PSD.DataStreamSupporter.Save(Stream stream)
   at Aspose.PSD.DataStreamSupporter.Save(String filePath)
   at ...

Please advise.
test.zip (1.6 MB)
Thanks.

@gonzalo.gatti.ethofy

It seems that you are encountering an issue when trying to save a PSD file using Aspose.PSD, where the error message indicates that “The rectangle has no common processing area.” This typically occurs when there is a problem with the layers in the PSD file, particularly if one of the layers cannot be processed correctly.

Here are a few suggestions to help you resolve this issue:

  1. Read-Only Mode: Try opening the PSD file in read-only mode. This can sometimes bypass issues related to layer rendering. You can modify your code as follows:

    var loadOptions = new PsdLoadOptions();
    loadOptions.LoadEffectsResource = true;
    loadOptions.ReadOnlyMode = true; // Set to true to open in read-only mode
    using (PsdImage image = (PsdImage)Image.Load(@opt.Psd, loadOptions))
    {
        image.Save(opt.Output);
    }
    
  2. Layer Issues: If the problem persists, it may be due to a specific layer in the PSD file that is causing the error. You might want to inspect the layers in the PSD file and see if any of them are problematic. If possible, try removing or flattening the layers that could be causing the issue.

  3. Update Aspose.PSD: Ensure that you are using the latest version of Aspose.PSD. There have been fixes related to layer processing in recent updates, so upgrading might resolve the issue.

  4. Check for Known Issues: Review the Aspose documentation or forums for any known issues related to the specific version you are using. Sometimes, specific bugs are documented along with workarounds.

If these suggestions do not resolve your issue, consider providing more details about the PSD file or the specific layers involved, as this may help in diagnosing the problem further.

Sources:
[1]: Error processing area top must be positive (Parameter ‘areaToProcess’)

Regarding the auto-response:
Read-Only Mode: this does prevent the exception, but it also prevents the actual changes I need to make to file, so it makes sense in this over simplified sample, but is not an actual solution.
Layer Issues: this is (sadly) out of the scope of the issue (yeah, removing the stuff that breaks the code, prevents the code from breaking).
Update Aspose.PSD: this was my first instinct (the issue was detected using 24.10.0) but, as stated, 25.4.0 has the same issue and this is the latest available version right now
Check for Known Issues: I was not able to find anything related with this issue, hence the post.

@gonzalo.gatti.ethofy

We need time to investigate this. It looks, 25.4 has some regression, please try 25.3 or 25.2, I’ll write you back after investigation

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-2454

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.

Hi @Dmitriy.Sorokin,
Is this issue still happening in v25.5?
Thanks.

@gonzalo.gatti.ethofy I’ve checked additionally this. The team was not working with this issue, but in 25.5 the error for your provided file is not reproducible, so it was fixed as a part of some other task. Could you please check it and write back additional details if the issue can be reproduced on your side.