Grow your CSS skills. Land your dream job.

How to increase the height of an image created using putImagedata?

  • PSP
    # June 23, 2013 at 2:46 pm

    Is there any way to increase the height of image created using HTML5 canvas putImagedata.


    Your browser does not support the HTML5 canvas tag.


    # June 23, 2013 at 4:10 pm

    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

    PSP
    # June 23, 2013 at 11:40 pm

    Thank you, but it is not taking 5 arguements. Tried it.

Viewing 3 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic.

*May or may not contain any actual "CSS" or "Tricks".