forked from external-repos/squoosh
Optipng (#156)
* omg it’s compiling * example actually works * Expose compression level options * Disable crypto and path module emulation in webpack * Update README * Remove small image * Use -O3 on optipng * Free memory after copy * Handle unexpected file reader return types * Rename level label to effort
This commit is contained in:
@@ -9,6 +9,7 @@ import { FileDropEvent } from './custom-els/FileDrop';
|
||||
import './custom-els/FileDrop';
|
||||
|
||||
import * as quantizer from '../../codecs/imagequant/quantizer';
|
||||
import * as optiPNG from '../../codecs/optipng/encoder';
|
||||
import * as mozJPEG from '../../codecs/mozjpeg/encoder';
|
||||
import * as webP from '../../codecs/webp/encoder';
|
||||
import * as identity from '../../codecs/identity/encoder';
|
||||
@@ -89,6 +90,7 @@ async function compressImage(
|
||||
): Promise<File> {
|
||||
const compressedData = await (() => {
|
||||
switch (encodeData.type) {
|
||||
case optiPNG.type: return optiPNG.encode(image, encodeData.options);
|
||||
case mozJPEG.type: return mozJPEG.encode(image, encodeData.options);
|
||||
case webP.type: return webP.encode(image, encodeData.options);
|
||||
case browserPNG.type: return browserPNG.encode(image, encodeData.options);
|
||||
|
||||
Reference in New Issue
Block a user