Socket
Socket
Sign inDemoInstall

@types/pixelmatch

Package Overview
Dependencies
1
Maintainers
1
Versions
10
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    @types/pixelmatch

TypeScript definitions for pixelmatch


Version published
Weekly downloads
461K
increased by6.01%
Maintainers
1
Install size
3.82 MB
Created
Weekly downloads
 

Readme

Source

Installation

npm install --save @types/pixelmatch

Summary

This package contains type definitions for pixelmatch (https://github.com/mapbox/pixelmatch#readme).

Details

Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/pixelmatch.

index.d.ts

/// <reference types="node" />

declare function Pixelmatch(
    /** Image data of the first image to compare. Note: image dimensions must be equal. */
    img1: Buffer | Uint8Array | Uint8ClampedArray,
    /** Image data of the second image to compare. Note: image dimensions must be equal. */
    img2: Buffer | Uint8Array | Uint8ClampedArray,
    /** Image data to write the diff to, or null if don't need a diff image. */
    output: Buffer | Uint8Array | Uint8ClampedArray | null,
    /** Width of the images. Note that all three images need to have the same dimensions. */
    width: number,
    /** Height of the images. Note that all three images need to have the same dimensions. */
    height: number,
    /** Options. */
    options?: Pixelmatch.PixelmatchOptions,
): number;

declare namespace Pixelmatch {
    type RGBTuple = [number, number, number];

    interface PixelmatchOptions {
        /**
         * Matching threshold, ranges from 0 to 1. Smaller values make the comparison more sensitive.
         * @default 0.1
         */
        readonly threshold?: number | undefined;
        /**
         * If true, disables detecting and ignoring anti-aliased pixels.
         * @default false
         */
        readonly includeAA?: boolean | undefined;
        /**
         * Blending factor of unchanged pixels in the diff output.
         * Ranges from 0 for pure white to 1 for original brightness
         * @default 0.1
         */
        alpha?: number | undefined;
        /**
         * The color of anti-aliased pixels in the diff output.
         * @default [255, 255, 0]
         */
        aaColor?: RGBTuple | undefined;
        /**
         * The color of differing pixels in the diff output.
         * @default [255, 0, 0]
         */
        diffColor?: RGBTuple | undefined;
        /**
         * An alternative color to use for dark on light differences to differentiate between "added" and "removed" parts.
         * If not provided, all differing pixels use the color specified by `diffColor`.
         * @default null
         */
        diffColorAlt?: RGBTuple | undefined;
        /**
         * Draw the diff over a transparent background (a mask), rather than over the original image.
         * Will not draw anti-aliased pixels (if detected)
         * @default false
         */
        diffMask?: boolean | undefined;
    }
}

export = Pixelmatch;

Additional Details

  • Last updated: Tue, 07 Nov 2023 09:09:39 GMT
  • Dependencies: @types/node

Credits

These definitions were written by Oleg Repin, Piotr Błażejewicz, and Damian Frizzi.

FAQs

Last updated on 07 Nov 2023

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc