> ## Documentation Index
> Fetch the complete documentation index at: https://docs.embededitor.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Saved State

> Store the edits Save hands back and reopen the photo exactly as it was, every edit still editable.

Store the edits with the photo, then reopen them later with the `state` prop.

## What Save Gives Back

`onProcess` receives two things:

| Field | Type | What it is |
| - | - | - |
| `dest` | `File` | The image Save made. |
| `state` | `EditState` | The edits it was made with. |

Without `onProcess`, Save downloads the file.

## Store It

The state is plain JSON. Keep it next to the original photo.

```tsx React theme={"dark"}
import { EmbedEditor } from '@embededitor/full/react';
import type { EditState } from '@embededitor/full/react';

const upload = async ({ dest, state }: { dest: File; state: EditState }) => {
  const body = new FormData();

  body.append('file', dest);
  body.append('state', JSON.stringify(state));
  await fetch('/api/photos', { body, method: 'POST' });
};

const PhotoEditor = ({ src }: { src: string }) => (
  <div style={{ height: 600 }}>
    <EmbedEditor onProcess={upload} src={src} />
  </div>
);

export default PhotoEditor;
```

```js JavaScript theme={"dark"}
import { mountEditor } from '@embededitor/full/standalone';

mountEditor(document.getElementById('editor'), {
  onProcess: async ({ dest, state }) => {
    const body = new FormData();

    body.append('file', dest);
    body.append('state', JSON.stringify(state));
    await fetch('/api/photos', { body, method: 'POST' });
  },
  src: '/photos/sunset.jpg'
});
```

## Reopen It

Pass the original photo as `src` and the stored state as `state`. The photo reopens exactly as it was saved.

```tsx React theme={"dark"}
<EmbedEditor src={photo.originalUrl} state={photo.state} />
```

```js JavaScript theme={"dark"}
mountEditor(document.getElementById('editor'), {
  src: photo.originalUrl,
  state: photo.state
});
```

Every edit stays editable: the crop, rotation and flips, adjustments, Auto, filter, frame, obfuscated areas, annotations, the person's watermark and signature changes, and the output size.

> [!NOTE]
>
> `src` and `state` are read when the editor opens. To load another photo, give `EmbedEditor` a new `key`, or destroy and mount again.

## What to Know

* **Never an image.** The state holds no pixels. Watermarks and signatures come back from your props.
* **Every field is written**, defaults included. A state you write by hand may leave any field out; a missing field reads as its default.
* **Screen units.** Adjustments run −100 to 100, rotation is in degrees, geometry is in px of the size the editor works the photo at.
* **`version` is `3`.** A wrong version, a value out of range or more than 64 areas is an `INVALID_STATE` error. The editor never opens a state half-applied.
* [`processImage`](https://docs.embededitor.com/api-reference/process-image) resolves to a state too, ready for the `state` prop.

Every field is documented in the [state reference](https://docs.embededitor.com/api-reference/state.md).

> [card] [State Reference](https://docs.embededitor.com/api-reference/state.md)
>
> Every field of `EditState`.

> [card] [Migrating from Pintura](https://docs.embededitor.com/saving/pintura.md)
>
> Open states saved by Pintura.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.