Image APIs,
under control.
Implementation guides for the contracts, trust boundaries, transformation recipes, browser delivery, and operational evidence behind production image systems.
-

Crop Images Around a Focal Point
A focal crop should store the important region as source-relative metadata and derive each output from that stable intent.
-

Resize Images Without Distorting Aspect Ratio
Resize from a declared fit policy and preserve the source aspect ratio unless the product explicitly requests a crop or distortion.
-

Build a Safe Image Transformation Grammar
A safe transformation grammar exposes a small allowlisted vocabulary with bounded values and a canonical order.
-

Use Checksums to Detect Corrupt Uploads
Use transport checksums for corruption detection and content hashes for deduplication only when their different semantics are explicit.
-

Retry Multipart Image Uploads Safely
Retry multipart uploads by chunk identity and server acknowledgment, never by blindly replaying the entire operation.
-

Track Upload Progress in the Browser
Browser progress should report transferred bytes separately from server validation and post-upload processing.
-

Build Resumable Image Uploads
A resumable upload needs a durable session, stable chunk identity, acknowledged offsets, and an explicit finalize step.
-

Choose Signed or Unsigned Browser Uploads
Prefer signed browser uploads when users can influence valuable parameters; reserve unsigned presets for tightly constrained, low-risk intake.
-

Scan SVG Uploads Before Publishing
Treat SVG as active structured content: sanitize or rasterize it, and serve it with a policy appropriate to your threat model.
-

Defend Image Uploads from Decompression Bombs
Defend against decompression bombs by limiting decoded work, parser time, dimensions, frames, and memory in an isolated processing boundary.
-

Limit Image Dimensions and Pixel Count at Upload
Enforce byte, width, height, frame, and total pixel limits before expensive transforms begin.
-

Validate File Type Beyond the Extension
Validate decoded content and an allowlisted format, because extensions and client-declared MIME types are only hints.