Add options for webp and tiff

This commit is contained in:
Silas Rech
2018-02-25 19:20:33 +01:00
parent f2fb883ac0
commit d2e34706c9

View File

@@ -382,14 +382,14 @@ declare namespace sharp {
* @throws {Error} Invalid options
* @returns A sharp instance that can be used to chain operations
*/
webp(options?: OutputOptions): SharpInstance;
webp(options?: WebpOptions): SharpInstance;
/**
* Use these TIFF options for output image.
* @param options Output options.
* @throws {Error} Invalid options
* @returns A sharp instance that can be used to chain operations
*/
tiff(options?: OutputOptions): SharpInstance;
tiff(options?: TiffOptions): SharpInstance;
/**
* Force output to be raw, uncompressed uint8 pixel data.
* @returns A sharp instance that can be used to chain operations
@@ -498,6 +498,28 @@ declare namespace sharp {
optimizeScans?: boolean;
}
interface WebpOptions extends OutputOptions {
/** Quality of alpha layer, number from 0-100 (optional, default 100) */
alphaQuality?: number;
/** Use lossless compression mode (optional, default false) */
lossless?: boolean;
/** Use near_lossless compression mode (optional, default false) */
nearLossless?: boolean;
}
interface TiffOptions extends OutputOptions {
/** Compression options: lzw, deflate, jpeg (optional, default 'jpeg') */
compression?: string;
/** Compression predictor options: none, horizontal, float (optional, default 'horizontal') */
predictor?: string;
/** Horizontal resolution in pixels/mm (optional, default 1.0) */
xres?: number;
/** Vertical resolution in pixels/mm (optional, default 1.0) */
yres?: number;
/** Squash 8-bit images down to 1 bit (optional, default false) */
squash?: boolean;
}
interface PngOptions {
/** Use progressive (interlace) scan (optional, default false) */
progressive?: boolean;