rotateImage()
Rotates image around its center on a square canvas (side = max(width, height)), then crops transparent margins by trimming to the bounding box of pixels with non-zero alpha. Returns a new loaded HTMLImageElement (PNG data URL under the hood via renderImage).
angle is in degrees; converted with degToRad from yummies/math.
Very large sources can stress memory on some mobile browsers (known iPhone issues — see TODO in source).
Examples:
ts
const upright = await rotateImage(landscapeImg, 90);ts
const fixed = await rotateImage(await renderImage(file), -15);