Skip to content

Instantly share code, notes, and snippets.

@iha2
Created August 12, 2018 21:13
Show Gist options
  • Save iha2/ad0397bc68af1b67129941fda056bc77 to your computer and use it in GitHub Desktop.
Save iha2/ad0397bc68af1b67129941fda056bc77 to your computer and use it in GitHub Desktop.
draw image on canvas.
const drawImageOnCanvas = (
videoElem: HTMLVideoElement,
canvasElem: HTMLCanvasElement
) => {
const ctx = canvasElem.getContext('2d') as CanvasRenderingContext2D;
const canvasResolution = 224;
ctx.drawImage(videoElem, 224, 0, size, size, 0, 0, 224, 224);
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment