How to implement image rotation for existed one

Hi all
Any ideas on how I can manage rotation for the existed images with versions and aws storage?