mirror of
https://github.com/GoogleChromeLabs/squoosh.git
synced 2025-11-14 17:49:52 +00:00
Resize working
This commit is contained in:
@@ -1,5 +1,3 @@
|
|||||||
import * as __wbg_star0 from 'env';
|
|
||||||
|
|
||||||
let wasm;
|
let wasm;
|
||||||
|
|
||||||
let cachegetUint8Memory0 = null;
|
let cachegetUint8Memory0 = null;
|
||||||
@@ -113,7 +111,6 @@ async function init(input) {
|
|||||||
input = import.meta.url.replace(/\.js$/, '_bg.wasm');
|
input = import.meta.url.replace(/\.js$/, '_bg.wasm');
|
||||||
}
|
}
|
||||||
const imports = {};
|
const imports = {};
|
||||||
imports['env'] = __wbg_star0;
|
|
||||||
|
|
||||||
if (
|
if (
|
||||||
typeof input === 'string' ||
|
typeof input === 'string' ||
|
||||||
|
|||||||
Binary file not shown.
@@ -2,7 +2,7 @@ FROM emscripten/emsdk:1.39.19 AS wasm-tools
|
|||||||
WORKDIR /opt/wasm-tools
|
WORKDIR /opt/wasm-tools
|
||||||
RUN wget -qO- https://github.com/rustwasm/wasm-pack/releases/download/v0.9.1/wasm-pack-v0.9.1-x86_64-unknown-linux-musl.tar.gz | tar -xzf - --strip 1
|
RUN wget -qO- https://github.com/rustwasm/wasm-pack/releases/download/v0.9.1/wasm-pack-v0.9.1-x86_64-unknown-linux-musl.tar.gz | tar -xzf - --strip 1
|
||||||
|
|
||||||
FROM rust:1.44-stretch AS rust
|
FROM rust:1.46.0-slim-buster AS rust
|
||||||
RUN rustup target add wasm32-unknown-unknown
|
RUN rustup target add wasm32-unknown-unknown
|
||||||
COPY --from=wasm-tools /emsdk/upstream/bin/wasm-opt /emsdk/upstream/bin/clang /usr/local/bin/
|
COPY --from=wasm-tools /emsdk/upstream/bin/wasm-opt /emsdk/upstream/bin/clang /usr/local/bin/
|
||||||
COPY --from=wasm-tools /emsdk/upstream/lib/ /usr/local/lib/
|
COPY --from=wasm-tools /emsdk/upstream/lib/ /usr/local/lib/
|
||||||
|
|||||||
@@ -31,8 +31,8 @@ async function demo() {
|
|||||||
const data = ctx.getImageData(0, 0, img.width, img.height);
|
const data = ctx.getImageData(0, 0, img.width, img.height);
|
||||||
const result = await api.resize(data, {
|
const result = await api.resize(data, {
|
||||||
fitMethod: 'stretch',
|
fitMethod: 'stretch',
|
||||||
height: 20,
|
height: 200,
|
||||||
width: 20,
|
width: 200,
|
||||||
linearRGB: false,
|
linearRGB: false,
|
||||||
premultiply: true,
|
premultiply: true,
|
||||||
method: 'lanczos3',
|
method: 'lanczos3',
|
||||||
@@ -49,6 +49,7 @@ async function demo() {
|
|||||||
canvas.height = result.height;
|
canvas.height = result.height;
|
||||||
const ctx = canvas.getContext('2d')!;
|
const ctx = canvas.getContext('2d')!;
|
||||||
ctx.putImageData(result, 0, 0);
|
ctx.putImageData(result, 0, 0);
|
||||||
|
document.body.append(canvas);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user