Increase control over output metadata (#3856)

Add withX and keepX functions to take advantage of
libvips 8.15.0 new 'keep' metadata feature.
This commit is contained in:
Lovell Fuller
2023-11-22 09:03:57 +00:00
committed by GitHub
parent 3f7313d031
commit e78200cc84
13 changed files with 694 additions and 179 deletions

View File

@@ -659,6 +659,18 @@ sharp('input.tiff').webp({ preset: 'drawing' }).toFile('out.webp');
sharp('input.tiff').webp({ preset: 'text' }).toFile('out.webp');
sharp('input.tiff').webp({ preset: 'default' }).toFile('out.webp');
// Allow a boolean or an object for metadata options.
// https://github.com/lovell/sharp/issues/3822
sharp(input).withMetadata().withMetadata({}).withMetadata(false);
sharp(input)
.keepExif()
.withExif({
IFD0: {
k1: 'v1'
}
})
.withExifMerge({
IFD1: {
k2: 'v2'
}
})
.keepIccProfile()
.withIccProfile('filename')
.withIccProfile('filename', { attach: false });