Add keepXmp and withXmp for control over output XMP metadata #4416

This commit is contained in:
Thibaut Patel
2025-06-11 21:24:09 +02:00
committed by Lovell Fuller
parent df5454e7dc
commit 4e3f3792ad
10 changed files with 303 additions and 2 deletions

16
lib/index.d.ts vendored
View File

@@ -419,7 +419,7 @@ declare namespace sharp {
* @returns {Sharp}
*/
autoOrient(): Sharp
/**
* Flip the image about the vertical Y axis. This always occurs after rotation, if any.
* The use of flip implies the removal of the EXIF Orientation tag, if any.
@@ -730,6 +730,20 @@ declare namespace sharp {
*/
withIccProfile(icc: string, options?: WithIccProfileOptions): Sharp;
/**
* Keep all XMP metadata from the input image in the output image.
* @returns A sharp instance that can be used to chain operations
*/
keepXmp(): Sharp;
/**
* Set XMP metadata in the output image.
* @param {string} xmp - String containing XMP metadata to be embedded in the output image.
* @returns A sharp instance that can be used to chain operations
* @throws {Error} Invalid parameters
*/
withXmp(xmp: string): Sharp;
/**
* Include all metadata (EXIF, XMP, IPTC) from the input image in the output image.
* The default behaviour, when withMetadata is not used, is to strip all metadata and convert to the device-independent sRGB colour space.