mirror of
https://github.com/wassname/DefinitelyTyped.git
synced 2026-09-09 11:13:57 +08:00
Merge pull request #4507 from horiuchi/imagemagick-native
imagemagic-native: fix `convert` options on stream version
This commit is contained in:
@@ -73,7 +73,11 @@ imagemagick.convert(options, (err: any, buffer: Buffer) => {
|
||||
// check err, use buffer
|
||||
});
|
||||
fs.createReadStream('input.png')
|
||||
.pipe(imagemagick.streams.convert(options))
|
||||
.pipe(imagemagick.streams.convert({
|
||||
quality: 75,
|
||||
width: 160,
|
||||
height: 160
|
||||
}))
|
||||
.pipe(fs.createWriteStream('output.png'));
|
||||
|
||||
|
||||
|
||||
+20
-1
@@ -9,7 +9,7 @@ declare module "imagemagick-native" {
|
||||
|
||||
import stream = require('stream');
|
||||
export module streams {
|
||||
export function convert(options: IConvertOptions): stream.Transform;
|
||||
export function convert(options: IStreamConvertOptions): stream.Transform;
|
||||
}
|
||||
|
||||
function convert(options: IConvertOptions): Buffer;
|
||||
@@ -23,6 +23,25 @@ declare module "imagemagick-native" {
|
||||
function quantumDepth(): number;
|
||||
function version(): string;
|
||||
|
||||
export interface IStreamConvertOptions {
|
||||
srcFormat?: string;
|
||||
quality?: number;
|
||||
trim?: boolean;
|
||||
trimFuzz?: number;
|
||||
width?: number;
|
||||
height?: number;
|
||||
density?: number;
|
||||
resizeStyle?: string;
|
||||
gravity?: string;
|
||||
format?: string;
|
||||
filter?: string;
|
||||
blur?: number;
|
||||
strip?: boolean;
|
||||
rotate?: number;
|
||||
flip?: boolean;
|
||||
debug?: boolean;
|
||||
ignoreWarnings?: boolean;
|
||||
}
|
||||
export interface IConvertOptions {
|
||||
srcData: Buffer;
|
||||
srcFormat?: string;
|
||||
|
||||
Reference in New Issue
Block a user