I’m working on a UXP plugin for Photoshop that exports a large number (up to 10,000) image files from a single document. This works fine when saving as JPG, however, when trying to do the same with PNG files, Photoshop crashes after around 5000 images. I attached the full error report below, but I couldn’t really make much sense of it.
I’m using API version 2 with PS v23.4.2 on Windows 10. The export takes place within a modal context using
executeAsModal with history suspended as I need to make changes to the document between exports. I’m fairly sure memory usage is not the issue, as the task manager shows PS only using around 4GB of the allocated ~8GB.
Here’s a list of things I’ve already tried, unfortunately the crash still occurs with all of them:
- Using the
batchPlayAPI instead of
activeDocument.saveAs.pngto save the file
- Removing all code that changes the document between exports (effectively making my plugin only save the document 10k times)
- Changing the PNG save options (compression, method etc.)
- Adding a delay of about 0.5s after each save
- Disabling Graphics Processor in the settings
- Purging cache after each batch of 100 images
Does anyone have any ideas what the issue might be or how I may be able to work around it? I’d appreciate any suggestions, I’ve been struggling with this issue for close to a week now.
Here’s the full crash report as provided by PS as a Pastebin (can’t add it here because of the character limit): Crash Report