mirror of
https://github.com/lovell/sharp.git
synced 2025-07-09 10:30:15 +02:00
TypeScript: add definition for keepMetadata (#3914)
This commit is contained in:
parent
cd5cf7ce2d
commit
77ab5d7a51
6
lib/index.d.ts
vendored
6
lib/index.d.ts
vendored
@ -341,6 +341,12 @@ declare namespace sharp {
|
|||||||
*/
|
*/
|
||||||
metadata(): Promise<Metadata>;
|
metadata(): Promise<Metadata>;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Keep all metadata (EXIF, ICC, XMP, IPTC) from the input image in the output image.
|
||||||
|
* @returns A sharp instance that can be used to chain operations
|
||||||
|
*/
|
||||||
|
keepMetadata(): Sharp;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Access to pixel-derived image statistics for every channel in the image.
|
* Access to pixel-derived image statistics for every channel in the image.
|
||||||
* @returns A sharp instance that can be used to chain operations
|
* @returns A sharp instance that can be used to chain operations
|
||||||
|
@ -44,6 +44,12 @@ sharp('input.png')
|
|||||||
// sharpened, with metadata, 90% quality WebP image data. Phew!
|
// sharpened, with metadata, 90% quality WebP image data. Phew!
|
||||||
});
|
});
|
||||||
|
|
||||||
|
sharp('input.png')
|
||||||
|
.keepMetadata()
|
||||||
|
.toFile('output.png', (err, info) => {
|
||||||
|
// output.png is an image containing input.png along with all metadata(EXIF, ICC, XMP, IPTC) from input.png
|
||||||
|
})
|
||||||
|
|
||||||
sharp('input.jpg')
|
sharp('input.jpg')
|
||||||
.resize(300, 200)
|
.resize(300, 200)
|
||||||
.toFile('output.jpg', (err: Error) => {
|
.toFile('output.jpg', (err: Error) => {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user