I use a python script to pick out the latest pictures from a ftp site and rotate them and size them and move them to the www directory. I use crons to run that script every 10 mins (you can use HA) and then HA camera images point to the www directory. My python script is very personalized for my application but here is the libraries that manipulate the pictures and moves them.
import operator
import shutil
import os
import glob
import time
import contextlib
from PIL import Image
and this is the part which rotates the image.
with contextlib.suppress(OSError):
img5 = Image.open("/Users/xxxx/ram/www/CAM3r.jpg")
img5.LOAD_TRUNCATED_IMAGES = True
img6 = img5.rotate(-90, expand=True)