diff --git a/lib/index.d.ts b/lib/index.d.ts index 5ed41577..c68c848d 100644 --- a/lib/index.d.ts +++ b/lib/index.d.ts @@ -341,6 +341,12 @@ declare namespace sharp { */ metadata(): Promise; + /** + * 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. * @returns A sharp instance that can be used to chain operations diff --git a/test/types/sharp.test-d.ts b/test/types/sharp.test-d.ts index 4be5eeb6..1c08ae35 100644 --- a/test/types/sharp.test-d.ts +++ b/test/types/sharp.test-d.ts @@ -44,6 +44,12 @@ sharp('input.png') // 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') .resize(300, 200) .toFile('output.jpg', (err: Error) => {