Reputation: 24061
Im reading a file, checking it's exif data, adding to canvas and transforming if necessary.
I need to keep the canvas the same size as the original image, I've tried this:
ctx.drawImage(img, 0, 0, img.width, img.height, 0, 0, img.width, img.height);
This seems to default the canvas size to the default of 300 x 150.
How can I make the canvas the size of the image?
Upvotes: 0
Views: 36
Reputation: 2611
ctx.canvas.width = img.width
ctx.canvas.height = img.height
Should work fine
Upvotes: 2