Add unflatten operation to create an alpha channel (#3461)

This commit is contained in:
Anton Marsden
2023-04-07 22:01:29 +12:00
committed by GitHub
parent b9c3851515
commit a4c6eba7d4
11 changed files with 93 additions and 0 deletions

7
lib/index.d.ts vendored
View File

@@ -427,6 +427,13 @@ declare namespace sharp {
*/
flatten(flatten?: boolean | FlattenOptions): Sharp;
/**
* Unflatten - add an alpha channel to the image if required, and make white pixels fully transparent. Alpha for non-white pixels will be unchanged/opaque.
* @param unflatten true to enable and false to disable (defaults to true)
* @returns A sharp instance that can be used to chain operations
*/
unflatten(unflatten?: boolean): Sharp;
/**
* Apply a gamma correction by reducing the encoding (darken) pre-resize at a factor of 1/gamma then increasing the encoding (brighten) post-resize at a factor of gamma.
* This can improve the perceived brightness of a resized image in non-linear colour spaces.