In this scenario after creating an image object and determining the width and height, how can I then change the width and height of the image object? I would already know the window dimensions so I need to resize the image accordingly. I am already using jQuery on the page if there is a jQuery-based solution but it seems to be straight JS to me. img.width = doesn't work and I have been searching for an answer and so far I can't locate one. Any help will be greatly appreciated.

HTML Code:
img = new Image(); 
img.src = 'http://pathtoimage.png';
// Execute code after image loads
img.onload = function() {
    // Assign image's width, height to vars
    var img_width = img.width;
    var img_height = img.height;