Sunday, 4 September 2011

How to batch crop JPEG photos, scans, images






Here's how to crop a bunch of JPEGs with the free JPEGCrops (Windows), which I used where I needed to chop half an inch (of printer-ink-wasting-black) off the top edge of one set of scanned music score pages, and half an inch off the bottom edge of another set (where I'd turned the book upside down to scan those pages). I couldn't find a proper howto, so here's my step by step.

Cropping multiple files in a batch saves having to open, crop and save each JPEG individually. You just set the edges of the first image (where you want it to be cropped to), and the rest of the photos or pics can automatically be set to the same dimensions.

If all the unwanted bits are on the same part of every image, eg always the left margin or always the bottom margin, you can use the excellent free PDFill PDFTools. My problem was that for some images I needed to crop one edge, and for others another edge, so I couldn't do that - hence JPEGCrops.

I couldn't get JPEGCrops to work fully at first, so here's my step by step tutorial, including all the basic stuff most people skate over:

  1. Download, install and open JPEGCrops. It's a bit blank looking, but that'll change.


  2. See the folder name in the bottom right? That's the folder into which the software will automatically save the cropped images, in my case "C:\Users\myloginname\Cropped". You can change the location of that folder via the menu File > Select Output Dir to choose another folder, but obviously you need to do that before you crop the images in question.

  3. Go to menu File > Preferences and choose your Default Aspect and OK. In my case, as I'm in the UK, it's A4 - your mileage may vary. Feel free to experiment and change it for each set of images and see how it looks.


    (The Preferences box is weird on my system, many buttons aren't visible, probably something to do with my system.)

  4. Now in JPEGCrops open up the pics that you need to crop. There are 2 possible ways -
    1. use the menu File > Open Images (or click the "Open Images" button at the bottom left), then navigate to the folder containing your JPEGs, then select the files you want; you can select several files by holding down the Ctrl key as you click on the ones you want, and click Open, or
    2. in Windows Explorer or Computer, navigate to the right folder, select the images you want (again Ctrl and clicking, or the Spacebar key for hotkey fans, does the trick), and drag the selected images into the JPEGCrops window.

  5. Your selected images should now all be in JPEGCrops. Look at the first pic. You'll see parts of it are greyed out, and parts of it are more clearly visible with a white background. The cropping will get rid of the greyed out bits.


  6. Depending on your situation, you may want to UNtick the "Flip aspect" button, as I did, to get a proper Portrait view:


  7. There are white horizontal and vertical bars around the clearly visible bit. You'd drag these with your mouse to outline the area of the JPEG that you want to keep. But don't do that just yet!

  8. This is the step I missed: first, go to the Edit menu, make sure "Synchronize Crops" is ticked (it isn't in the pic below), by selecting it if necessary.


    This is to make sure that the crops etc you make to one image will automatically be done to all the others you opened in JPEGCrops. Otherwise you have to tediously do them one by one, which kinda defeats the purpose of using "batch" image editing software!

  9. Now that sync is on, you can drag the white bars to outline the part of the image that you want to keep. There are right and left curly arrows at the bottom left which you can use if you also want to rotate all images at once.


  10. Once you've done the edits, it's a good idea to scroll down through all the images in JPEGCrops to check that the correct parts are outlined in all the images. This is to avoid cutting important bits off the occasional image, especially if you haven't scanned them all in exactly the same way and sometimes had the book (or whatever) a few millimetres off.

    You may find you have to tweak some of the edges one way or the other, so that you have the sections you need outlined in all the pages. Worse comes to worse, you could untick the synchronisation, then tweak it just for a particular problem image or two.

  11. When all set, click the "Crop all images" button (NOT the "Crop" button):


  12. It automatically crops them and saves the cropped images in a new folder, the folder mentioned in step 2. (You can open that folder quickly by clicking in the box, selecting the folder path info and copying it into clipboard, then pasting it into your Windows Explorer address bar.)

  13. In my case, I then repeated this with a different set of JPGs where I needed to crop a different edge off. Then I stitched the cropped images together into a single PDF file for ease of printing, rather than having to print each cropped image one by one - PDFill Tools works great for that too (it's the "Convert Images to PDF" button, then drag and drop the image files, and reorder images in the list if necessary).

No comments: