INNER CODE UNIT · TypeScript
resize
silvia-odwyer/photon · webpack_demo/src/index.ts:371
const resize = (event: Event, photon: ExtendedPhotonModule) => {
if (!ensureContexts()) {
return;
}
console.time("resize");
const resizedContainer = document.getElementById("resized_imgs");
if (!resizedContainer) {
return;
}
ctx.drawImage(newimg, 0, 0);
timing.start = performance.now();
const photonImg = photon.open_image(canvas, ctx);
const newCanvas = photon.resize_img_browser(photonImg, 200, 200, 1);
resizedContainer.appendChild(newCanvas);
timing.end = performance.now();
updateBenchmarks();