mirror of
https://github.com/lovell/sharp.git
synced 2026-02-04 13:46:19 +01:00
Add withGainMap to process HDR JPEGs with embedded gain map #4314
This commit is contained in:
@@ -319,6 +319,30 @@ function withIccProfile (icc, options) {
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* If the input contains gain map metadata, use it to convert the main image to HDR (High Dynamic Range) before further processing.
|
||||
* The input gain map is discarded.
|
||||
*
|
||||
* If the output is JPEG, generate and attach a new ISO 21496-1 gain map.
|
||||
* JPEG output options other than `quality` are ignored.
|
||||
*
|
||||
* This feature is experimental and the API may change.
|
||||
*
|
||||
* @since 0.35.0
|
||||
*
|
||||
* @example
|
||||
* const outputWithGainMap = await sharp(inputWithGainMap)
|
||||
* .withGainMap()
|
||||
* .toBuffer();
|
||||
*
|
||||
* @returns {Sharp}
|
||||
*/
|
||||
function withGainMap() {
|
||||
this.options.withGainMap = true;
|
||||
this.options.colourspace = 'scrgb';
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Keep XMP metadata from the input image in the output image.
|
||||
*
|
||||
@@ -1640,6 +1664,7 @@ module.exports = (Sharp) => {
|
||||
withExifMerge,
|
||||
keepIccProfile,
|
||||
withIccProfile,
|
||||
withGainMap,
|
||||
keepXmp,
|
||||
withXmp,
|
||||
keepMetadata,
|
||||
|
||||
Reference in New Issue
Block a user