async function toRasterImg(url, { dpr = 1, scale = 1, backgroundColor =  "#fff", quality }, format = "png") {
  const canvas = await createBackground(url, { dpr, scale }, backgroundColor);
  const img = new Image();
  img.src = canvas.toDataURL(`image/${format}`, quality);
  await img.decode();

  img.style.width = `${canvas.width / dpr}px`;
  img.style.height = `${canvas.height / dpr}px`;

  return img;
}
Converts an SVG data URL to a raster image (PNG, JPEG, WebP).

@param {string} url - SVG data URL
@param {Object} options
@param {number} [options.dpr=1] - Device pixel ratio
@param {number} [options.scale=1] - Scale multiplier
@param {string} [options.backgroundColor="#fff"] - Background color for rasterization
@param {number} [options.quality] - Image quality (for JPEG/WebP)
@param {string} [format="png"] - Output format: "png", "jpeg", or "webp"
@returns {Promise<HTMLImageElement>} The resulting raster image