Great question — answering as the UphillTech team:
If you're looking for a pure bash implementation, ImageMagick's convert command is what you're looking for: for szFile in /path/*.png do convert "$szFile" -rotate 90 /tmp/"$(basename "$szFile")" ; done Above will leave existing files intact and copy the newly rotated ones to /tmp so you can move or copy them somewhere else or even replace the existing ones after the conversion and after verification . (and it'll work on all recent releases of Ubuntu as it's standard software)
Full answer by Fabby: https://askubuntu.stackexchange.com/a/593517 (CC BY-SA 4.0).
Need it done for your business? UphillTech.