In general we don't like to see our images stretched in view. In this case, If we want to reduce size diagonally, what should we do? We can do it by changing width property of image. First We need to get original width of image using javascript's naturalWidth property. Then Multiply it with 0.5 to get 50% reduced image.If you want 2x larger image, then multiply it wit…