Skip to content

Instantly share code, notes, and snippets.

@leesei
Last active November 30, 2022 03:23
Show Gist options
  • Save leesei/b514f25bcd980eadee24a47ce43ddc22 to your computer and use it in GitHub Desktop.
Save leesei/b514f25bcd980eadee24a47ce43ddc22 to your computer and use it in GitHub Desktop.
`d.ts` for reimg, MIT license
// Type definitions for reimg 1.0
// Project: https://github.com/gillyb/reimg
// Definitions by: leesei <https://github.com/leesei>
declare module "reimg" {
type OutputProcessor = {
toBase64: () => string;
toImg: () => HTMLImageElement;
toCanvas: (callback: (canvas: HTMLCanvasElement) => void) => string;
toPng: () => HTMLImageElement;
toJpeg: (quality?: number = 1.0) => HTMLImageElement;
downloadPng: (filename?: string = "image.png") => void;
};
type ReImg = {
fromSvg: (svgElement: HTMLCanvasElement) => OutputProcessor;
fromCanvas: (canvasElement: HTMLCanvasElement) => OutputProcessor;
};
export const { ReImg }: { ReImg: ReImg };
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment