How to compress images on Linux fast with ImCompressor
Image files get bigger and bigger these days, and it’s starting to get out of hand. If you’re using Linux, and you’re sick of dealing with large, bloated image files, you may want to compress them. The best way to do that is to use an app called ImCompressor.
Install ImCompressor on Linux
Before we can go over how to use the ImCompressor application to make your image files much smaller on Linux, the app needs to be installed. Currently, there are three ways to install it: Arch Linux AUR, Flatpak, and via the source code. In this guide, we will demonstrate all three methods of installing ImCompressor.
Arch Linux AUR
If you’re an Arch Linux user, you’ll have an easy way of installing the ImCompressor application. To start, use the Pacman command to load up both the “Base-devel,” and “Git” packages, as they are necessary for working with the AUR.
sudo pacman -S git base-devel
Once both the Git and Base-devel packages are set up on your Arch Linux PC, use the git clone command to grab the latest version of the Trizen AUR helper. With this app, ImCompressor is much easier to install, as it will automatically install all required dependency files.
git clone https://aur.archlinux.org/trizen.git
Move into the “trizen” folder with the CD command and install the Trizen app with the makepkg command.
cd trizen
makepkg -sri
With the Trizen AUR helper installed on your Linux PC, you can use it to quickly and easily install the ImCompressor tool from the Arch Linux AUR.
trizen -S imcompressor
Flatpak
The developers of ImCompressor maintain a Flatpak version of their application, as it makes it compatible with every Linux distribution on the market. Better yet, it means that it’s incredibly easy to install.
To install the ImCompressor application, head over to our guide, and learn how to enable the Flatpak runtime. Then, use the commands below to get ImCompressor working.
flatpak remote-add --if-not-exists flathub https://flathub.org/repo/flathub.flatpakrepo flatpak install flathub com.github.huluti.ImCompressor
Source code
Building ImCompressor on Linux requires GTK 3, Git, Meson, Python 3, OptiPNG, Pngquant, and Jpegotim. They must be installed for the source code to compile correctly. Please head over to the project’s GitHub page to learn how to install them.
Once all dependencies are installed, open up a terminal window by pressing Ctrl + Alt + T or Ctrl + Shift + T on the keyboard. Then, use the git clone command to grab the source code for ImCompressor.
git clone https://github.com/Huluti/ImCompressor.git
With the code downloaded, use the CD command to move the terminal window into the “ImCompressor” folder.
cd ImCompressor
Next, use the meson command to generate a “build” directory.
meson _build
When the meson command finishes generating the build environment, use the CD command, and move into the “_build” directory.
cd _build
Using the ninja command, compile the ImCompres source code.
ninja
Finally, install the program using the ninja install program.
sudo ninja install
The ImCompressor application can be easily uninstalled with:
sudo ninja uninstall
Using ImCompressor
ImCompressor is a very simple application that can take any JPEG or PNG file and compress it in size. In this tutorial, we’ll show you how to compress both image formats.
To start, open up the ImCompressor application on the Linux desktop. Then, when the program is open, find the “Lossless/Lossy” slider. By default, this slider is set to “Lossless” for lossless compression. Lossless is a great setting to keep it at for most situations. However, if you want lossy compression, click on the slider and change it to “Lossy.”
Compressing PNG files
ImCompressor uses OptiPNG and Pngquant to make PNG files smaller. If you’d like to compress some PNG files in the app, follow the step-by-step instructions below.
Step 1: Find the “Browse your files” button, and click on it with the mouse to bring open the open-file dialog box on the screen.
Step 2: Using the open-file dialog box, find the PNG image file you want to compress to a smaller size. If you’d like to select multiple files, hold down Ctrl while selecting.
Step 3: Click the “Open” button to start the compression process instantly.
Your compressed PNG files will have “min” in the file name.
Compressing JPG/JPEG files
The ImCompressor tool makes use of Jpegotim to make JPG and JPEG files smaller on the Linux desktop. To compress some JPG/JPEG files on your Linux PC, follow the step-by-step instructions below.
Step 1: Locate the “Browse your files” button, and select it with the mouse. Clicking this button will bring up an open-file dialog box.
Step 2: Use the open-file dialog box to find the JPG/JPEG image file you’d like to make smaller. To add in multiple JPG/JPEG files, hold down the Ctrl button while clicking.
Step 3: Select the “Open” button in the open-file dialog box to start the compression process.
Your compressed JPG/JPEG files will have “min” in the file name.