Skip to main content
Crop, resize and convert a photo with no editor on screen.

Make a Thumbnail

thumbnail.ts
processImage is exported from both entries, /react and /standalone. It resolves to { dest, state }: the File it made, and an edit state ready for the editor’s state prop.

Options

src takes everything the editor’s src takes. Every option is optional. Without crop or aspectRatio, it keeps the whole image. Output never goes past 16.7 MP, whatever targetSize asks for. Given both crop and aspectRatio, the returned state keeps aspectRatio only when crop already has that ratio. Otherwise the state is free, so reopening it never refits the crop.

Units over 16.7 MP

A photo over 16.7 MP is worked at a smaller copy (see Large photos). Mind the units:
  • crop is in the file’s own px, and lands on the same region of the copy.
  • The returned state is in the copy’s px, ready for the editor’s state prop.
Don’t pass the returned state’s crop back as the crop option. Those px aren’t the file’s.

Errors

processImage rejects with an EmbedEditorError.

processImage

The full signature.

Watermark & Signature

Draw the host’s marks on the result.