image.platinumcloud.net
English日本語한국어简体中文繁體中文

For developers

Add image editing to your site

Open this editor from a button on your page and get the edited image back as a File. The image stays in the browser and is never uploaded. Free, with no sign-up or API key.

Button images

Edit with Online Image Editor
image-editor-black.pngBlack
Edit with Online Image Editor
image-editor-white.pngWhite

Put one of these on the button that opens the editor. Show it at 200×40 px; the files are 2× for sharp screens. They are also in the npm package, under @platinumcloud/image-editor/badge/.

Build your code

Answer the questions and the code to paste is written below. Everything except the first question is optional: leave it at the default if you do not need it.

1How do you load it?
npm for apps with a bundler (React, Vue, Next.js…); a script tag for plain HTML pages.
2Where is the image chosen?Optional
In the editor, the person picks, drops or pastes an image there, so your page needs no file input. Or pass an image your site already has.
3Crop frameOptional
A fixed shape keeps the frame at that ratio; exact pixels also makes the result exactly that size.
4FormatOptional
None ticked: same as the original. Tick several and the person chooses one in the editor; the first ticked is preselected. Formats the browser cannot write are left out (Safari cannot write WebP).
5QualityOptional
How hard lossy formats are compressed.
6ToolsOptional
Untick the ones your site does not need.
7Editor languageOptional
By default the editor follows the browser's language.
8Button
One of the button images, or a button of your own.

Your code

  1. Install the package.

    npm install @platinumcloud/image-editor
  2. Put the button on your page.

    <button type="button" id="edit-image" style="padding: 0; border: 0; background: none; cursor: pointer">
      <img src="https://image.platinumcloud.net/embed/badge/image-editor-black.png"
           width="200" height="40" alt="Edit with Online Image Editor">
    </button>
  3. Add this code.

    import { editImage } from '@platinumcloud/image-editor';
    
    const button = document.getElementById('edit-image');
    
    button.addEventListener('click', async () => {
      const edited = await editImage();
      if (!edited) return; // cancelled, or the editor was closed
      console.log(edited); // a File: upload it or show it
    });

edited is the edited image as a File, or null when the person cancels or closes the editor.

Try it

Opens the editor with the settings above, as your page would.

Result

Before you ship

  • Call it straight from the click handler. Awaiting something first can make the browser block the popup (PopupBlockedError).
  • Do not send Cross-Origin-Opener-Policy: same-origin from your page; it cuts the link to the editor window. same-origin-allow-popups is fine.
  • Check the type and size of the returned file before you upload it. The editor follows your options, but the file comes back through the browser.