How to compress images fast: GUI and CLI options
If you need to compress one or several images, using lossless or lossy techniques, here you can find some command line and graphical tools.
Table of Contents
ImageMagick (CLI)
Most popular tool on Linux for creating, editing, composing or converting digital images.
- Compress JPEG image (lossy compression)
magick convert original.jpg -quality <quality value> output.jpg
<quality value>
goes from 1 (lowest quality) to 100 (best quality)
- Compress PNG image (lossless)
magick convert original.png -quality <quality value> output.png
<quality value>
sets the zlib compression level (quality / 10) and filter-type (quality % 10).- For more precise control, you can use these
-define
values:PNG:compression-level=<value between 0 and 10>
,PNG:compression-strategy=<value>
, andPNG:compression-filter=<value between 0 and 9>
- Compress several images (changing filenames and/or output directory)
magick convert img*.jpg -quality <quality value> some_folder/test%d.jpg
magick convert img*.jpg -quality <quality value> -set filename:fname '%t_new' some_folder/%[filename:fname].jpg
# keep filenames magick convert img*.jpg -quality <quality value> -set filename:fname '%t' some_folder/%[filename:fname].jpg
- Compress several images (overwrite)
magick mogrify -quality <quality value> img*.jpg
NOTE: In recent versions of ImageMagick (from 7.0) convert
command is deprecated. Simply use magick
.
GraphicsMagick (CLI)
Originally derived from ImageMagick in 2002, but completely independent after that. It is considered more efficient and smaller than ImageMagick but some IM commands may not work on GM.
- Compress JPEG images (lossy)
gm convert original.jpg -quality <quality value> output.png
- Compress PNG image (lossless)
gm convert original.png -quality <quality value> output.png
- Compress several images (changing output directory)
gm mogrify -quality <quality value> -output-directory some_folder img*.jpg
- Compress several images (overwrite)
gm mogrify -quality <quality value> img*.jpg
Curtail (GUI)
Curtail is a simple image compressor that creates compressed images in the same folder as original ones (but does not overwrite them). Just select or drag and drop your files. Press the three-bar menu to change compression settings (Preferences
).
Converseen (GUI)
With this app you can make several modifications to one or several images. Compress an image is easy: select the files (Click Open images
), select an output folder (scroll down inside Actions Panel
to see the Output options
) and choose a compression level (press Images settings
). Finally, click Convert
.
If you have any suggestion, feel free to contact me via social media or email.
Latest tutorials and articles:
Featured content: