Image Cropping Algorithms
Image cropping extracts rectangular regions from source images using Canvas API. The process involves: loading image into Image object, creating canvas with target dimensions, using drawImage() to render specified region (sourceX, sourceY, sourceWidth, sourceHeight mapped to destX, destY, destWidth, destHeight), and exporting to blob/dataURL. Aspect ratio preservation calculates dimensions: if maintaining width, height = width / ratio;