Best way to do repeated saves of indexed images from layers

I have a batch process that extracts assets from a psd, which means a very large number of indexed images (animation sequences and sprites, so there are a LOT of related images).
Unforttunately, chamge mode indexed means flattening the psd, so layers get lost.

Doc duplicate appears to be very expensive.

So, with that being the case, would it be cheaper to close and reopen the document instead of duplicating it? The change mode operation I do before each save is destructive, so I can’t just change the state back (change mode to indexed and then save).
The only choices I know about are :frowning:

  1. Duplicate and change things in the duplicate and close it,
    2 Change it in the existing document and then undo via history to return to the initial state
  2. Do in existing document and close and reopen the original filename to get back to the state prior to the indexed mode operation.
    Since indexing also loses layers, I can’t do it and then work on the parts, so I’m stuck redoing the index operation right before save again and again, and ending up duplicating the document thousands of times.
    Am I missing an option to simplify this process? The script is toggling layers on and off, so each image is unique, and the script can also move an item (simple sprite animation).
    The problem I seem stuck on is how to efficiently return to the pre change-mode state to continue with the next image.

How about history snapshots (instead of steps)? And would non-linear history help?

I take a Snapshot of the document, run my operations, and then revert back to the Snapshot.

In the future, there might be the possibility to duplicate documents but not show duplicates in UI which would make performance faster. I will ask what is the status of that.

4 Likes