mirror of
https://github.com/GoogleChromeLabs/squoosh.git
synced 2025-11-15 10:09:45 +00:00
Reenable resize
This commit is contained in:
@@ -40,7 +40,7 @@ const oxipngPromise = oxipng.default(fsp.readFile(pathify(oxipngWasm)));
|
|||||||
// Resize
|
// Resize
|
||||||
import * as resize from '../../codecs/resize/pkg/squoosh_resize.js';
|
import * as resize from '../../codecs/resize/pkg/squoosh_resize.js';
|
||||||
import resizeWasm from 'asset-url:../../codecs/resize/pkg/squoosh_resize_bg.wasm';
|
import resizeWasm from 'asset-url:../../codecs/resize/pkg/squoosh_resize_bg.wasm';
|
||||||
// const resizePromise = resize.default(fsp.readFile(pathify(resizeWasm)));
|
const resizePromise = resize.default(fsp.readFile(pathify(resizeWasm)));
|
||||||
|
|
||||||
// rotate
|
// rotate
|
||||||
import rotateWasm from 'asset-url:../../codecs/rotate/rotate.wasm';
|
import rotateWasm from 'asset-url:../../codecs/rotate/rotate.wasm';
|
||||||
@@ -96,46 +96,46 @@ function resizeWithAspect({
|
|||||||
}
|
}
|
||||||
|
|
||||||
export const preprocessors = {
|
export const preprocessors = {
|
||||||
// resize: {
|
resize: {
|
||||||
// name: "Resize",
|
name: 'Resize',
|
||||||
// description: "Resize the image before compressing",
|
description: 'Resize the image before compressing',
|
||||||
// instantiate: async () => {
|
instantiate: async () => {
|
||||||
// await resizePromise;
|
await resizePromise;
|
||||||
// return (
|
return (
|
||||||
// buffer,
|
buffer,
|
||||||
// input_width,
|
input_width,
|
||||||
// input_height,
|
input_height,
|
||||||
// { width, height, method, premultiply, linearRGB }
|
{ width, height, method, premultiply, linearRGB },
|
||||||
// ) => {
|
) => {
|
||||||
// ({ width, height } = resizeWithAspect({
|
({ width, height } = resizeWithAspect({
|
||||||
// input_width,
|
input_width,
|
||||||
// input_height,
|
input_height,
|
||||||
// target_width: width,
|
target_width: width,
|
||||||
// target_height: height
|
target_height: height,
|
||||||
// }));
|
}));
|
||||||
// return new ImageData(
|
return new ImageData(
|
||||||
// resize.resize(
|
resize.resize(
|
||||||
// buffer,
|
buffer,
|
||||||
// input_width,
|
input_width,
|
||||||
// input_height,
|
input_height,
|
||||||
// width,
|
width,
|
||||||
// height,
|
height,
|
||||||
// resizeNameToIndex(method),
|
resizeNameToIndex(method),
|
||||||
// premultiply,
|
premultiply,
|
||||||
// linearRGB
|
linearRGB,
|
||||||
// ),
|
),
|
||||||
// width,
|
width,
|
||||||
// height
|
height,
|
||||||
// );
|
);
|
||||||
// };
|
};
|
||||||
// },
|
},
|
||||||
// defaultOptions: {
|
defaultOptions: {
|
||||||
// method: "lanczos3",
|
method: 'lanczos3',
|
||||||
// fitMethod: "stretch",
|
fitMethod: 'stretch',
|
||||||
// premultiply: true,
|
premultiply: true,
|
||||||
// linearRGB: true
|
linearRGB: true,
|
||||||
// }
|
},
|
||||||
// },
|
},
|
||||||
// // TODO: Need to handle SVGs and HQX
|
// // TODO: Need to handle SVGs and HQX
|
||||||
quant: {
|
quant: {
|
||||||
name: 'ImageQuant',
|
name: 'ImageQuant',
|
||||||
|
|||||||
Reference in New Issue
Block a user