loading... Pacem JS

Imaging

Image resizing utility.

Available in Web Workers.

Syntax

// method
Pacem.Utils.Images.resize(src: string | Blob, width: number, height: number, options?: ImagingResizeOptions) : Promise<Blob>

Arguments

Demo

// example: downloading a resized image
const pacemResizeFn = Pacem.Utils.Images.resize;
const blob = await pacemResizeFn("/assets/pic001.png", 128, 128, { mode: "contain", align: "center", valign: "middle", background: "#f00", type: "image/webp" });
Pacem.Utils.download(blob, "resized.webp");

Test the above code block by clicking the button below.