Skip to content

-ImageMagick

1. What is ImageMagick?

ImageMagick is a nice tool to compressed images.

2. NOTE-format

I learned below.
- JPG: high compress
- PNG: less compress

3. Install

It is the first time to use. so, in Terminal, I Install ImageMagick with below command.

brew install imagemagick

I confirm the Image Magic's version with below command.

convert -version

Version: ImageMagick 7.1.0-60 Q16-HDRI
alt text

4. Cheat sheet

Encoding in class.

5. TEST

I made new folder. (folder name: compress_photo)
Then, In terminal, I change directory to the folder.

  • convert all PNGs to JPGs:
mogrify -format jpg *.png

The Result: Done
alt text

Delete the PNG's in the folder.
alt text

Secondly, I do the code of Encoding in class.
- compress all JPGs to quality 50% width 1000:

mogrify -quality 50% -resize 1000 *.jpg

The Result: Done!! Compared to the original PNG file, the size is much smaller.
alt text

Compare the size information view:
Before: 458KB
alt text
after: 89KB alt text

I check the compressed image results, the result image is still good to see, and the size is much smaller, it's nice! so I will use these 2 codes primarily.

6, My Impressions

  • I feel scared using Terminal, so It is a task I am not good at.
  • I am happy, I confirmed that it can be used without any problem.