Image editor: the JavaScript library

Data and helpers of the image editor: color palette, shapes, color conversion and named colors in 29 languages.

  • @openlibsdev/image-editor
  • v1.0.0
  • ES module
  • MIT

Installation

With a bundler or Node-style imports:

npm install @openlibsdev/image-editor
import ImageEditor from "@openlibsdev/image-editor";

Or straight in a page, without a build step (jsDelivr resolves the dependencies):

<script type="module">
import ImageEditor from "https://cdn.jsdelivr.net/npm/@openlibsdev/image-editor@1.0.0/+esm";
</script>

Usage

import ImageEditor from "@openlibsdev/image-editor";

console.log(ImageEditor.toHex("rgb(13, 110, 253)"));   // "#0d6efd"
console.log(ImageEditor.hexA("#0d6efd", 0.5));
const color = await ImageEditor.findNamedColor("dark blue", "en");

API

ImageEditor.toHex(c)

Any CSS color → #rrggbb.

ImageEditor.hexA(hex, a)

Color with transparency.

ImageEditor.PALETTE

Default palette.

ImageEditor.SHAPES

Shapes.

ImageEditor.starPoints()

Points of a star shape.

ImageEditor.findNamedColor(text, lang)

Finds a named color by its name in the given language ("dark blue" → #00008b).

ImageEditor.listNamedColors(lang)

Lists the named colors with their names in the given language.

ImageEditor.EXTRA

Names of the object properties saved with a project besides the standard ones (name, lock, id, blend mode).

ImageEditor.LBL

Default layer names by object type (rectangle, ellipse, text, image, group, …).

ImageEditor.namedColorTexts(lang)

Labels of the color field in the given language (the texts of the color picker), English for a missing language.

ImageEditor.textFontData

Data for a text and font block: the font list, loading a font style, adding a font file, the block's labels in a language and the default values.

ImageEditor.APP

Name and version of the library: {name, version}.

Dependencies

What the library loads, with the licenses (all are listed on the Licenses page).

NameVersionLicenseFiles
@openlibsdev/font-forge1.0.0MITGitHub
@openlibsdev/image-forge1.0.0MITGitHub
@imagemagick/magick-wasm0.0.35Apache-2.0 License · Source code
@imagemagick/magick-wasm0.0.35Apache-2.0 License · Source code
@simonwep/pickr1.10.2MIT License · Source code
@simonwep/pickr1.10.2MIT License · Source code
dejavu-fonts-ttf2.37.3Bitstream Vera Fonts License (free, redistributable); DejaVu changes are public domain License · Source code
fabric5.3.0MIT License · Source code
imagetracerjs1.2.6Unlicense License · Source code
jspdf2.5.2MIT License · Source code