To modify an image proportionally, simply only alter one of the width/height css properties, leave the other set to auto.
image.style.width = '50%'
image.style.height = 'auto'
This will ensure that its aspect ratio remains the same.
Bear in mind that browsers tend to suck at resizing images nicely - you'll probably find that your resized image looks horrible.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…