Skip to main content
Open the crop at a ratio, lock it, and control the size and type of the file Save writes.

What the User Can Do

The Adjust tool holds the crop. It’s in every edition.
The Adjust tool on a mountain lake: 3:4 picked in the ratio strip, its window centered on the peak and its reflection, the photo outside it dimmed, Done under the strip
A ratio takes the largest window of that shape, placed where Focus says. A handle follows the finger as far as the toolbar, the editor’s sides and the crop pill. Let go, the window rests there for a moment, then springs back to fill the photo’s area, centered, as on the iPhone.
The same 3:4 crop on an iPhone: the window over the photo, the ratio strip under it from 1:1 to 16:9, and Done

Open at a Ratio

aspectRatio is width / height. The user can still pick another ratio.
Banner.tsx

Lock a Ratio

Add aspectRatioLocked to fix the ratio. The ratio selector is hidden.
Avatar.tsx

Ratios

  • Changing aspectRatio live applies as one step undo can take back.
  • Changing the lock live starts a new undo history at the locked ratio, so undo can’t free it.
  • Two ratios within half a percent of each other count as one.

Output Size and Type

Upload.tsx
  • Either cap alone limits its own side. Both fit the output inside both. The ratio is kept, and the output is never enlarged by a cap.
  • The output never goes past 16.7 MP.
  • A source that isn’t JPEG, PNG or WebP (HEIC, AVIF, GIF…) saves as PNG unless you set outputType.
  • The file keeps the source’s name with the output’s extension, or image.<ext> when it has none.

Large Photos

How photos over 16.7 MP are handled.

Props

Every prop, with types and defaults.