cleanupImages
Discards the images that are no longer in use. Note that you cannot remove a particular image directly by ID, for it might be used in multiple sheets, or they can be referenced by the undo/redo queue. This function acts like a "garbage collector" — it checks which images are no longer needed, and removes them.