Image resizing utility.
Available in Web Workers.
// method
Pacem.Utils.Images.resize(src: string | Blob, width: number, height: number, options?: ImagingResizeOptions) : Promise<Blob>
src
: the URL or payload of the image.width
: target width.height
: target height.options
(optional): tweaks on how the resize process should be made.// 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.