Forums

The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums JavaScript How to increase the height of an image created using putImagedata? Re: How to increase the height of an image created using putImagedata?

#139993
pixelgrid
Participant

put image data accepts up to 5 arguements.

if you use it like this

ctx.putImageData(imgData,10,70);

it will paint imgData to the canvas the top left point being (10,70);

if you use it like this

ctx.putImageData(imgData,10,70,50,50);

the imgData will be painted from (x,y) = (10,70) and its width and height being 50 each.

this operation scales the image but if you choose different height than width depending on the img aspect ratio it will strech it to fit the area you defined