title: "How to optimize image for websites from the command line"
date: 2023-11-10T22:16:00+00:00
---
When hosting your website with a lot of images, your users need a lot of bandwidth just to load some images, but most of the time the image doesn't need to be that big for the user to load. Here is a guide on how to optimize images for these kind of situations, credits to [Eric Murphy](https://youtu.be/8zj44m0hAoU?si=wAkGlGn5CSWYKR9n). I typed the video in text format as it is such a good video that I want to take notes of that.
1. Install imagemagick
```sh
sudo pacman -S imagemagick
```
# Optimise JPGs
```sh
convert image.jpg -resize 400x400 image.min.jpg # resize image as you don't always need that big
convert image.jpg -quality 75 image.min.jpg # reduce quality of image, 75% is a good compromise between file size and quality