@extenshi/mcp
Version:
Extenshi MCP server — bring the extension catalog (search, security, market research) and pre-publish scanning into your AI tools
40 lines • 1.92 kB
TypeScript
/**
* PNG output for store artwork and screenshots: 24-bit RGB when every pixel is
* opaque, RGBA otherwise.
*
* resvg and Chromium both write RGBA (colour type 6) even for a fully opaque
* image, and the Chrome Web Store asks for screenshots and promo tiles as
* 24-bit PNGs with no alpha. Re-encoding is lossless — the pixels are the same,
* only the unused alpha byte goes.
*
* Deliberately small: 8-bit, non-interlaced, colour types 2 and 6 — exactly
* what resvg and Chromium produce. Anything else passes through untouched.
*/
/**
* Encode raw 8-bit pixels; each row gets the filter with the smallest sum of
* absolute values. `keep` are whole chunks (colour space, pixel density) copied
* from a source PNG so the re-encoded image renders the same.
*/
export declare function encodePng(data: Uint8Array, width: number, height: number, channels: 3 | 4, keep?: readonly Buffer[]): Buffer;
export interface DecodedPng {
width: number;
height: number;
/** 3 for RGB, 4 for RGBA. */
channels: 3 | 4;
data: Uint8Array;
/** Colour-space and density chunks, verbatim, for a faithful re-encode. */
keep: Buffer[];
}
/** Decode an 8-bit, non-interlaced RGB or RGBA PNG; null for anything else. */
export declare function decodePng(png: Uint8Array): DecodedPng | null;
/** RGBA pixels → an RGB PNG when every pixel is opaque, null when any is not. */
export declare function rgbPngIfOpaque(rgba: Uint8Array, width: number, height: number, keep?: readonly Buffer[]): Buffer | null;
/**
* The same image as a 24-bit PNG when it is fully opaque; the input unchanged
* when it has transparency, is already RGB, or is a format this module does
* not read.
*/
export declare function opaquePngAsRgb(png: Uint8Array): Buffer;
/** The PNG colour type from IHDR (2 = RGB, 6 = RGBA). */
export declare function pngColorType(png: Uint8Array): number;
//# sourceMappingURL=png.d.ts.map