Hello Folks!

I was searching images for my blog and found a good website that offers free images https://unsplash.com/. This website lets you download images for free and use them without credit. See the license. But it is good to credit the authors :).

The images are usually high resolution and in the size of few MBs. I downloaded this nature image and it was of 5.4 MB with 3999×4998 px resolution.

$ ls -lh nature.jpg 
-rw-rw-r-- 1 himanshug himanshug 5.4M Jun 29 18:50 nature.jpg

$ file nature.jpg 
nature.jpg: JPEG image data, JFIF standard 1.01, resolution (DPI), density 72x72, segment length 16, baseline, precision 8, 3999x4998, frames 3

Now I want to use this image on my blog with not in so big resolution and prefer to have the file size in few KBs. Compressing the JPEG will not help reduce the file size to make it in KB.

So, what to do? Idea is to resize the image from this resolution to a lower one. We will use “convert” tool provided by imagemagick. Install imagemagick and run the following command to resize.

# Resize to 20% of original image
$ convert -resize 20% nature.jpg nature-resized.jpg

$ ls -lh nature*
-rw-rw-r-- 1 himanshug himanshug 5.4M Jun 29 18:50 nature.jpg
-rw-rw-r-- 1 himanshug himanshug 182K Jun 29 19:10 nature-resized.jpg

$ file nature-resized.jpg 
nature-resized.jpg: JPEG image data, JFIF standard 1.01, resolution (DPI), density 72x72, segment length 16, baseline, precision 8, 800x1000, frames 3

Now, the image is of 800×1000 px that serves my need and size has come down from 5.4 MB to 182 KB (~96%) without loosing the image quality. Wow, that’s terrific.

Left side is resized one and Right side is original

If you are also looking for same, this will definitely help you.

Do you use any other tool on Linux for such purpose, comments?


Aryan

Hey Friends, Thank you for visiting my blog and spending some time reading it. Myself Aryan who works in computer technologies and keeps on pen down my understanding of various topics. This blog is a write-up of my understanding of various technologies after reading different materials about it. I hope that it helps you in some way.

0 Comments

Leave a Reply

Your email address will not be published. Required fields are marked *