Resize Image But Keep Aspect Ratio. So you have placed an image on your webpage and decided to resize it a little but a slight problem happened and the image goes out of proportions. Is there a more efficient way to do this.
Viewed 54k times 17. Ask question asked 5 years 11 months ago. Or vice versa set the height of the image and the width to auto.
Is there a more efficient way to do this.
5 begingroup i wrote some code that resizes an image to fit in a given box. X px keep aspect ratio fill in the background with a solid color if the proportion of image changed. So you have placed an image on your webpage and decided to resize it a little but a slight problem happened and the image goes out of proportions. Or vice versa set the height of the image and the width to auto.