illustrator.js
Version:
JavaScript image processing library
25 lines (24 loc) • 1.12 kB
TypeScript
/// <reference types="node" />
import { Canvas, Image, ImageData } from "@napi-rs/canvas";
import { Illustrator } from "../illustrator/Illustrator";
import { IllustratorImage } from "./IllustratorImage";
import { Layer } from "../layer/Layer";
export declare type IllustratorImageSource = string | URL | Buffer | Image | Canvas | ArrayBuffer | SharedArrayBuffer | Uint8Array | Layer | Illustrator | IllustratorImage | ImageData;
export declare class ImageLoader extends null {
private constructor();
/**
* Loads the given source into `Image` instance.
* @param source The image source to load
* @example import { loadImage } from "illustrator.js";
*
* const image = await loadImage("https://example.com/image.png");
* console.log(image.width, image.height);
*/
static loadImage(source: IllustratorImageSource, bufferOnly?: false): Promise<Image>;
static loadImage(source: IllustratorImageSource, bufferOnly?: true): Promise<Buffer>;
/**
* Creates `Image` instance
* @param data The image source data
*/
static createImage(data: Buffer): Image;
}