Implement sRGB color conversion (#510)

* Add sRGB -> RGB conversion before resize

* Add clamping for color space conversions

* Clip for demultiplication as well

* Fixing linear <-> srgb conversion

* Update benchmark

* Decouple srgb calculations

* Generate lookup tables

* Update src/codecs/resize/options.tsx

* Defaulting on, renaming, removing redundant state
This commit is contained in:
Surma
2019-03-12 14:09:35 +00:00
committed by Jake Archibald
parent 496896e36e
commit bf4d4b78cb
13 changed files with 157 additions and 36 deletions

View File

@@ -45,7 +45,7 @@ export async function resize(data: ImageData, opts: WorkerResizeOptions): Promis
const result = wasm_bindgen.resize(
new Uint8Array(input.data.buffer), input.width, input.height, opts.width, opts.height,
resizeMethods.indexOf(opts.method), opts.premultiply,
resizeMethods.indexOf(opts.method), opts.premultiply, opts.linearRGB,
);
return new ImageData(new Uint8ClampedArray(result.buffer), opts.width, opts.height);