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.
To provide the best experiences, we use technologies like cookies to store and/or access device information. Consenting to these technologies will allow us to process data such as browsing behavior or unique IDs on this site. Not consenting or withdrawing consent, may adversely affect certain features and functions.