Can I resize canvas size of psd file when using Aspose.psd for Python via .NET

Hello,
I am working with PSB files that have extremely large canvas dimensions (both width and height).

While using the Aspose.PSD for Python library to add text layers and save the file, I am encountering what appears to be a memory error during the process.

To address this issue, I am considering resizing the PSB file’s resolution.
In Photoshop, I confirmed that it is possible to reduce the overall canvas size—scaling all layers together—using Canvas Resize.

Is there a way to achieve a similar result programmatically using Aspose.PSD for Python?

Alternatively, I would also appreciate any recommendations or best practices for mitigating memory issues when working with very large PSB files.

@ppooiiuuyh

Short answer

Based on the information available, Aspose .PSD for Python does not provide a dedicated “Canvas Resize” method that works on a PSB the way Photoshop’s Image → Canvas Size does. To change the canvas size you would need to create a new document with the desired dimensions and copy/scale the existing layers yourself.

General guidance for large PSB files

  • Use a 64‑bit Python interpreter so the process can address more than 2 GB of RAM.
  • Dispose of PsdImage and any layer objects as soon as you are finished with them to free native memory.
  • Load only the parts of the file you need (e.g., avoid loading all layers at once) if the API offers such an option.

Because the forum post you referenced does not contain a specific solution or API example, the above recommendations are general best‑practice suggestions rather than documented features of Aspose .PSD. If you need detailed code examples or further assistance, providing a minimal reproducible snippet of how you are currently loading and saving the PSB would help narrow down a workable approach.

@ppooiiuuyh the answer of bot is correct, at this moment we don’t support “Canvas Resize”, because Aspose.PSD is API for file processing, not the UI. But I think for cases like you have, where the files are large, allocation of memory for the second image is not effective. So, I created request task “Implement “Resize Canvas” API to improve processing of large files and avoid double memory allocation”.

Could you please specify the size of the largest file you process and its dimensions, and if it possible. If it possible, please provide smaller copy of it, to help us test all your cases.

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

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.