[React] Canvas 사이즈에 맞춰 이미지의 원본 비율로 출력하기


[React] Canvas 사이즈에 맞춰 이미지의 원본 비율로 출력하기

const imgOnCanvas = (imageSrc) => { if (!canvasRef) return; const canvas = canvasRef.current; const ctx = canvasRef.current.getContext("2d"); setCanvas(canvas) setCtx(ctx); const image = new Image(); image.src =imageSrc image.onload = function() { console.log("-------------------------"); //입력 파일의 크기를 알아냄 let inW = image.width; let inH = image.height; console.log("[1]image 원본 - size",inW,inH); /..


원문링크 : [React] Canvas 사이즈에 맞춰 이미지의 원본 비율로 출력하기