MCPcopy Index your code
hub / github.com/OpenSignLabs/OpenSign / changeImageWH

Function changeImageWH

apps/OpenSign/src/constant/Utils.js:1979–1998  ·  view source on GitHub ↗
(base64Image)

Source from the content-addressed store, hash-verified

1977};
1978//function for select image and upload image
1979export const changeImageWH = async (base64Image) => {
1980 const newWidth = 300;
1981 const newHeight = 120;
1982 return new Promise((resolve, reject) => {
1983 const img = new Image();
1984 img.src = base64Image;
1985 img.onload = async () => {
1986 const canvas = document.createElement("canvas");
1987 const ctx = canvas.getContext("2d");
1988 canvas.width = newWidth;
1989 canvas.height = newHeight;
1990 ctx.drawImage(img, 0, 0, newWidth, newHeight);
1991 const resizedBase64 = canvas.toDataURL("image/png", 1.0);
1992 resolve(resizedBase64);
1993 };
1994 img.onerror = (error) => {
1995 reject(error);
1996 };
1997 });
1998};
1999
2000const getWidgetsFontColor = (type) => {
2001 switch (type) {

Callers 2

signPdfFunFunction · 0.90
signPdfFunFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected