async function toImg(url, { dpr = 1, scale = 1 }) {
  const img = new Image();
  img.src = url;
  await img.decode();
  if (isSafari) {
  img.width = img.width * scale ;
 img.height = img.height * scale ;
  } else {
    img.width = img.width / scale ;
 img.height = img.height / scale ;
  }
 
  return img;
}
Converts an SVG data URL to an HTMLImageElement.

@param {string} url - SVG data URL
@param {Object} options
@param {number} [options.dpr=1] - Device pixel ratio
@param {number} [options.scale=1] - Scale multiplier
@returns {Promise<HTMLImageElement>} The resulting image