202

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?

1

14 Answers 14

211

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

  1. Open your image in gThumb

enter image description here

  1. Open the Edit sidebar by pressing e or clicking on the easel in the top-right corner of the window

enter image description here

  1. In the sidebar click on Crop and then crop the image as you desire

enter image description here

  1. 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.
11
  • 18
    Once Gthumb has opened the image: Press e > Press C > Move the selection with two mouse down-drag-up (pity, one would have been sufficient) > Click "Crop" (no shortcut afaik) > Press Ctrl+s > Press Alt+F4. Cropping images is a very common activity, so I am still looking for a program that would do this in only one mouse down-drag-up, zero key press, zero click. Jan 25, 2013 at 6:35
  • Gthumb is a very nice IrvanView-like tool for Linux, but for some strange reason it always applies a kind of over-the-top blurring filter after croppping. Even more absurdly, it does that only after I've saved the cropped file, not in the preview. Any idea how to fix that? EDIT: scratch that - under saving options I had image smoothing at 100%. My mistake... ._.
    – FuzzyQ
    May 22, 2013 at 13:04
  • 1
    This is really great! At last a linux image processing tool that is easy to use. Just follow the 'e' then 'C' instructions from @NicolasRaoul .
    – Simd
    Jun 11, 2014 at 18:35
  • 3
    gthumb does the job nicely. I did find the way it organizes the various 'editing tools' a bit confusing. The 'crop tool' is not in the Window's 'Edit' menu, neither is it found in the 'Tools' toolbar menu. You have to click the 'Painter Palette' Icon. This opens a sidebar with more operations, 'Crop' is one of them. Actually took me a while to find that :-)
    – kris
    Oct 15, 2014 at 18:09
  • 1
    seems like the easiest option in Sep 2023 Sep 1, 2023 at 13:30
35

On the command line, the tool to manipulate bitmap images is imagemagick Install imagemagick or graphicsmagick Install 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.

7
  • isn't GM just a fork of IM? In your answer it sounds like a replacement to IM.
    – math
    Feb 21, 2014 at 11:04
  • @math Sloppy wording on my part. For some reason I thought that GM was now in main but it is in fact still IM. Edited, thanks. Feb 21, 2014 at 12:58
  • @Masi You need to add the output file name at the end. If you don't know the coordinates, you'll probably need to use an interactive tool, not a command line tool. The point of a command line tool is when you want to apply the same operation to many files. Jun 25, 2016 at 18:34
  • @Gilles Yes, I know. I am just thinking any accurate selection tool. What do you use to get the coordinates? I need to iterate the thing many times. Jun 25, 2016 at 21:43
  • 1
    @Mai ??? Neither the question nor my answer use the word “easy”. Nov 13, 2017 at 18:37
25

You can crop and export pretty quickly with Shotwell, it's pre-installed. Failing that try Pinta, it's in the Software Center.

4
  • 1
    Both do the work, but are far from graceful and fast. Closer than Gimp though, you`re right :) Jan 22, 2012 at 22:40
  • 1
    duffydack's answer might be the most lightweight program, if that's best for you. I just timed taking a screenshot, right-click & opening with Gimp, cropping and saving. It took me about 14 seconds, six of those were waiting for Gimp to open. That's pretty fast. Whatever you go with get to know the keyboard shortcuts, this will speed things up significantly. Jan 22, 2012 at 22:51
  • 3
    Speed depends on your system. Cold start gimp on this P4 1GB machine is something I dont like to think about :) But keyboard shortcuts is the tip Ill take. Jan 22, 2012 at 23:07
  • What shotwell misses is the maximize button. e.g. You need to manually fit a 13:18 or 10:15 ratio square to each image by dragging with the mouse. This is a pain when you want to prepare your photos for printing in a photo-printing shop (e.g. cropping them exactly where you like instead of the shop cropping them at the center to fit the standard 10x15/10x18 print sizes). gthumb has this feature.
    – Marinos An
    Sep 6, 2023 at 8:55
12

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:

https://github.com/pknowles/cropall

enter image description here

Uses imagemagick to do the crop, python/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.

5
  • Ahem... GIMP has crop right in the toolbox. There is no need to promote your script at the cost of other tools. Mar 15, 2015 at 16:18
  • 11
    @MichaelSchumacher If it takes longer than a click to select what I want cropped and a button to save and load the next image, it's not useful for this purpose. Imaging loading/saving a few hundred images in gimp. You'd be there all year. Also it's an existing tool - imagemagick - I just threw a trivial GUI over it for cropping. Don't get me wrong, if gimp or another tool could I wouldn't have bothered with the script.
    – jozxyqk
    Mar 16, 2015 at 3:03
  • 1
    I really liked your script. Thank you so much! It was simple - just what I was looking for! I was able to crop and resize 64 images in a matter of minutes. If possible, I would like the ability to drag a box around to define my own dimensions...
    – haferje
    Nov 22, 2015 at 20:18
  • @haferje thanks! I don't have any time to work on it at the moment, but you're welcome to fork it or create an issue on github to remind me to look at it later.
    – jozxyqk
    Nov 23, 2015 at 1:20
  • 2
    @MichaelSchumacher Some of us found his script useful and have modified it to our purposes. I've forked his script and added in features that suit our workflow. Just because you can't see the use-case, does not mean it's not useful.
    – Rystraum
    Feb 15, 2016 at 3:16
10

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).

ImageMagick

1
  • I don't think I've seen a worse UI than that of ImageMagick. Just tried to crop a screenshot with it and it distorted the screenshot. Would not recommend.
    – Basti
    Sep 8, 2023 at 9:09
7

As people suggested on the Internet, try CropGUI: http://emergent.unpythonic.net/01248401946

It does just lossless JPEG cropping.

4
  • 1
    Worth noting that the page linked to says there's only packaging for Ubuntu 8.04. That's pretty old. Jan 23, 2012 at 7:15
  • 1
    Give CropGUI another look. It calls 'jpegtran' on the back end for lossless cropping. It has a simple installer script that cleanly put its libraries in /usr/local without a package. It puts the main program to ~/bin/cropgui, so you may want to add ~/bin/ to your path. Pull the .zip from GitHub - github.com/jepler/cropgui, unzip it, and run the installer. I recommend './install.sh -f gtk -p /usr/local/'. It preserves your original file, and creates a new file with '_crop' appended before the extension. A recent fix now preserves EXIF data. It's working really well for me. Aug 4, 2014 at 15:43
  • Also, my multi-monitor setup makes CropGUI's default screen zoom in larger than is convenient. To address this, search for 'max_' in the code and change the multiplier used for max_h and max_w from 64 to something larger (I used 128). Aug 4, 2014 at 15:51
  • Is this really the only lossless cropper? None of the other answers mention it explicitly because it wasn't part of the question, but I'm surprised it's such a niche feature. Oct 2, 2023 at 10:35
7

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.

screenshot

1
  • It's worth adding that Gwenview is already installed as default image viewer on Kubuntu.
    – luator
    Jul 20, 2017 at 14:40
5

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.

enter image description here

  • 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.

enter image description here

enter image description here

1
  • 1
    Also Firefox, under the "page actions" menu (the "..." icon next to the address bar).
    – djvg
    Jan 10, 2019 at 15:07
4

I had the same problem and created a tool exactly for that:

https://github.com/weclaw1/inbac

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 poetry.

0
4

I use 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.

2

Can try Nomacs also, cropping and resizing is easily working there!

1
1

XnViewMP or IrfanView (under Wine). They worked for me ever since the Bronze (Windows) Age.

5
  • 1
    Not strictly off topic but -1 for suggesting Windows software when there are so many native alternatives. ;-P Jun 16, 2016 at 9:13
  • XnViewMP: MP=Multi Platform, and yes, it has deb, rpm, and tgz packages. I would say that's native. What's wrong with non-natives? Linux used lots of GNU software back in the days. Native does not always equal best. At least not for me. I'm not rasist.
    – ipse lute
    Jun 16, 2016 at 9:39
  • Oh, and there I was convinced that XnView was Windows-only. Never mind then. Jun 16, 2016 at 17:02
  • 2
    On another note, please don't use terms like "racist" inappropriately or inflationary. The analogy from human races to computing platforms doesn't fit at all since there can be no violation of rights because the right to live free from racial discrimination is a human right and programs aren't people. Jun 16, 2016 at 17:07
  • 1
    The "discrimination" of non-native and/or closed source software typically stems from the more difficult integration and maintenance as well as the resource overhead required by the adaptor software. Jun 16, 2016 at 17:14
0

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.

0

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.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .