I need to crop images often - photos, printscreens, etc., and loading gimp for such a simple task takes way too long. Can you recommend a faster alternative?
Gthumb is a nice image viewing/editing tool with simple editing tools like cropping. You can install Gthumb by running this on the command-line:
sudo apt install gthumb
Instructions for cropping in gThumb 3.2.8
- Open your image in gThumb
- Open the Edit sidebar by pressing e or clicking on the easel in the top-right corner of the window
- In the sidebar click on Crop and then crop the image as you desire
- Once finished press Enter or Crop. Then, in the Edit sidebar press Save to overwrite the original file or Save As to save to a new image file.
On the command line, the tool to manipulate bitmap images is imagemagick or graphicsmagick (GM is a split of the IM project, and more actively developed). This is a good option if you often use the same parameters.
convert raw.jpg -crop 800x460+100+20 cropped.jpg # ImageMagick gm convert raw.jgp -crop 800x460+100+20 cropped.jpg # GraphicsMagick
For ad hoc use where you need to see each image, you can use
display (also from the ImageMagick suite) or
gm display (GraphicsMagick) or Shotwell or Pinta or many other image viewers with light editing capabilities.
You can crop and export pretty quickly with Shotwell, it's pre-installed. Failing that try Pinta, it's in the Software Center.
Batch jobs and command line programs don't work too well for cropping if you have lots of different things you want to crop (i.e. the subject is in different areas in each image). Image editors like gimp and even some lightweight viewers still annoyingly have
crop hidden under a bunch of menus and then to throw load/save on top of that means most of your time is spent on navigation.
I threw together a small python script to automate a lot of this process but still let the human choose where to crop for each image:
imagemagick to do the crop,
tkinter for the preview.
It automatically runs through all images in a directory, click the area to crop, scroll to adjust size, then space to save (in a subdirectory) and load the next image.
ImageMagick. Launchable from CLI with
$ display <img>. Has visual cropping. Very lightweight (about 10Mb aside from dependencies), requires little more than libx11 and GNOME's libxml2.
ImageMagick is a software suite to create, edit, and compose bitmap images. It can read, convert and write images in a variety of formats (over 100) including DPX, EXR, GIF, JPEG, JPEG-2000, PDF, PhotoCD, PNG, Postscript, SVG, and TIFF. Use ImageMagick to translate, flip, mirror, rotate, scale, shear and transform images, adjust image colors, apply various special effects, or draw text, lines, polygons, ellipses and Bézier curves. All manipulations can be achieved through shell commands as well as through an X11 graphical interface (display).
As people suggested on the Internet, try CropGUI: http://emergent.unpythonic.net/01248401946
It does just lossless JPEG cropping.
How about Gwenview, which is a highly customizable and easy to use image viewer/image managing application.
- Crop function under "Menubar -> Edit -> Crop" or crtl + k
- Also supports simple image manipulations: rotate, mirror, flip, and resize, basic file management actions such as copy, move, delete and others.
- It is a Lightwave Application (with MB) and can be extended using KIPI plugins.
As a complement to the the main answers (gthumb, gwenview etc):
- An image can also be opened with a viewer but then cropped with a screenshot tool. There are many such tools depending on the desktop. As now there is an Ubuntu Budgie I'll take that example: Budgie has a panel applet to easily capture and save images; it may need to be added to the panel from the budgie settings.
- Opera browser has a crop and even editing tool. Opening the image in Opera (yes, you can), you can then crop and even add arrows and draw on it before saving.
I had the same problem and created a tool exactly for that:
Just select the part of image you want to crop and press:
- X to crop, or
- Z to crop and go to the next image.
You can install it using
pip by typing:
pip install --user inbac
or clone the repository and run it with
mogrify on the command line.
Go to the folder you want to modify and run:
$ mogrify -trim *.jpg
Done. It runs very fast. I just did several thousand images in 1 second.
Resizing is quite a bit slower.
I followed up the previous command with this:
$ mogrify -geometry 280x280\> *.jpg
\> indicates to resize to maximum dimensions specified, so all images will fit within)
That took 8 minutes.
just installed KolourPaint (part of the K desktop environment which appears to include GwenView), and that did it for me. seems stable under RHEL6.5, and i'll try it with Trusty tonight. i have very simple goals with this: support ctrl-V for paste directly after the app is started (something the otherwise great GwenView doesn't support), and simple cropping (in this case, ctrl-T) and copying back to the clipboard for reuse in an office or instant messaging app. it also supports several paint features. still not a full replacement for irfanview (if there even is one...beginning to conclude there really isn't), but i'll live.
The following is more of a hack.
You can use the mpv media player with the following crop script.
Just bind a script-binding to
toggle-crop in your
input.conf, open your file in mpv, hit the binding and then use the keyboard arrow keys to move to the first corner, hit enter, and then do the same for the other corner and hit enter. mpv is pretty lightweight and this script shows a nice selection rectangle all the way. You can then hit
s to save a screenshot of the result.