@types/image-blob-reduce
TypeScript icon, indicating that this package has built-in type declarations

4.1.4 • Public • Published

Installation

npm install --save @types/image-blob-reduce

Summary

This package contains type definitions for image-blob-reduce (https://github.com/nodeca/image-blob-reduce#readme).

Details

Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/image-blob-reduce.

index.d.ts

import type { Pica, PicaStatic } from "pica";

interface InternalProperties {
    image: HTMLImageElement;
    image_url: string;
    transform_width: number;
    transform_height: number;
    scale_factor: number;
    out_canvas?: HTMLCanvasElement;
    out_blob?: Blob;
}

type MethodNames = "_blob_to_image" | "_calculate_size" | "_transform" | "_create_blob" | "_cleanup";

declare namespace imageBlobReduce {
    interface ImageBlobReduce {
        init(): void;
        use(plugin: (args: any[]) => any, ...args: any[]): ImageBlobReduce;
        toBlob(blob: Blob, options?: ResizeOptions): Promise<Blob>;
        toCanvas(blob: Blob, options?: ResizeOptions): Promise<HTMLCanvasElement>;
        before(methodName: MethodNames, callback: (env: Env) => Promise<Env>): void;
        after(methodName: MethodNames, callback: (env: Env) => Promise<Env>): void;
    }

    interface Options {
        pica?: Pica;
    }

    interface Env extends InternalProperties {
        blob: Blob;
        opts: ResizeOptions;
    }

    interface ResizeOptions {
        alpha?: boolean;
        unsharpAmount?: number | undefined;
        unsharpRadius?: number | undefined;
        unsharpThreshold?: number | undefined;
        cancelToken?: Promise<unknown> | undefined;
        max?: number;
    }

    interface ImageBlobReduceStatic {
        new(options?: Options): ImageBlobReduce;
        (options?: Options): ImageBlobReduce;
        pica: PicaStatic;
    }
}

declare const imageBlobReduce: imageBlobReduce.ImageBlobReduceStatic;
export = imageBlobReduce;

Additional Details

  • Last updated: Tue, 07 Nov 2023 03:09:37 GMT
  • Dependencies: @types/pica

Credits

These definitions were written by Matthias Fischer.

Readme

Keywords

none

Package Sidebar

Install

npm i @types/image-blob-reduce

Weekly Downloads

6,085

Version

4.1.4

License

MIT

Unpacked Size

5.83 kB

Total Files

5

Last publish

Collaborators

  • types