Resize image
Compute real export pixels from target width/height and aspect lock; EXIF orientation is applied before scaling. 2000×1000 with locked aspect and width 1000 yields 1000×500, identical for preview and export.
Inputs and parameters
image— Image filetargetWidth— Target width (px, blank = unchanged)targetHeight— Target height (px, blank = unchanged)lockAspect— Lock aspect ratioquality— Quality (1–100)backgroundColor— Transparency background (#RRGGBB)
Real example
PNG 2000×1000, lockAspect=true, targetWidth=1000 (alpha=false)
→ {"resize":{"width":1000,"height":500,"scale":0.5,"previewOnly":false,"changesEncodedDimensions":true},"output":{"width":1000,"height":500}}
Limits and failure handling
Dimensions must be integers in 1–100000; outputs over 24 MP are rejected. Only dimension arithmetic is performed — no real resampling or pixel data this round; actual resized encoding is untested.
FAQ
Is only the preview scaled?
No. output.width/output.height are export pixels, identical to resize.width/height; previewOnly is always false.
What about an EXIF-rotated portrait photo?
The stored pixel grid is first normalized for orientation 6 to 3000×4000 with orientation reset to 1, then scaled by target width; no double rotation.