Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions lib/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -341,6 +341,12 @@ declare namespace sharp {
*/
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.
* @returns A sharp instance that can be used to chain operations
Expand Down
6 changes: 6 additions & 0 deletions test/types/sharp.test-d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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) => {
Expand Down