Nov 14

Install cropgui lossless JPG image crop on Ubuntu 20.04

Category: Linux,multimedia,Tools   — Published by goeszen on November 14, 2021 at 2:21 am

cropgui jpeg crop tool in action

For quick lossless cropping of JPEG images on Ubuntu Linux, cropgui is a perfect little tool. Yes, you've read that right: lossless cropping. That's because it builds on libjpeg, which has the ability to crop jpeg images lossless by discarding data blocks instead of recompressing the image.

First, install the prerequisites:

sudo apt install python3 python-pil libjpeg-progs libimage-exiftool-perl

Then grab and unpack cropgui from github:

$ wget https://github.com/jepler/cropgui/archive/refs/heads/main.zip
$ unzip main.zip
$ cd cropgui-main/
$ sudo bash ./install.sh -p /usr -P /usr/bin/python3 -f gtk

Note in the command above that we use the -f switch and state we want to install the "gtk" flavour of the app, as we can circumvent to install all the ancient tk stuff this way.

If you run into a strange error, telling you:

*** Failed to import cropgui_common.py
You must add /usr/lib/python3/dist-packages to PYTHONPATH

then check your command line. On the app's github README the python binary is referenced as /usr/bin/python while we have "python3" above in our command. The error doesn't point into the right direction.

Leave a Reply

=