Skip to content

Commit

Permalink
Merge pull request DefinitelyTyped#23908 from lenovouser/fix-sharp-pr…
Browse files Browse the repository at this point in the history
…operties

[sharp] Add options for webp and tiff
  • Loading branch information
armanio123 authored Mar 8, 2018
2 parents 02a9457 + d2e3470 commit ce574eb
Showing 1 changed file with 24 additions and 2 deletions.
26 changes: 24 additions & 2 deletions types/sharp/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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;
Expand Down

0 comments on commit ce574eb

Please sign in to comment.