How do you resize an img

How do you resize an img


I have an image that im trying to post but its too large how do i make it smaller


You can use tools like Gimp, Paint, Photoshop or other editing tools.

And thare are also webservices and softwares dedicated to image resizing:

I filtered the alternatives by opensource licenses, but there may be commercial demos as well.


I just wasn’t thinking clearly you can use the height and width attribute to resize an img


Ho :slight_smile:
No problem !


Know exactly what you’re getting… Resize display dimensions - yes. But the original file size remains.

If the image is 2MB, 1920x2048 size… doing this

<img src="bigphoto.jpg" width="300" height="200"> 

will still download to the user a 2MB file, albeit displayed as a small 300x200 image.


Don’t forget about which is great for the basics.

You can use CSS to resize too but it won’t change the actual file size as @owel said.


simply with css :
.myImg {
max-width:100%; /* or less */
height: auto;


For image optimization, I use a web app called Pixler. I also used it to make the icons for the social media links on my portfolio site.


also worth noting you can compress file size without losing image quality using