Function convertHTMLImageElementToCanvas

  • Converts an HTMLImageElement to a Canvas with specified dimensions. The image is scaled to fit the target width and height.

    Parameters

    • image: HTMLImageElement

      The source HTML image element

    • width: number

      The target canvas width

    • height: number

      The target canvas height

    Returns HTMLCanvasElement

    A new Canvas element containing the scaled image