Easy ways to crop after rotating in Gimp

December 8, 2009

When I posted the entry about editing the boots photo, I got a few comments about how I rotated the image.

One of the things that has always bothered me about rotating images in Gimp is that I have to manually crop the image after in order to get rid of all the transparent pieces that are left behind.

I don’t mind doing things manually because it gives me control, but what I wish I had was something that would automatically crop to the biggest image possible with now transparent bits, and then let me crop more after that if I desired – that way I’d be sure that I wasn’t accidentally including a bit of transparency in my crop.

I found two tools that are giving me a starting point. Let me show you what I’ve found.

First, I’m starting with this image:

Original Photo

Now, you already know I like to rotate by using the Corrective option and selecting to preview it with the grid, but this time, I also selected “Crop with aspect”. You might guess what this does – it automatically crops the photo after the rotate so that it has the same aspect ratio as the current photo.

Clipping option

It’s not quite as automatic as I’d like, because after rotating, my image still has the transparent “border” around it, like this:

Transparent "border"

So, it crops it, but the canvas size remains the same, so you can see all the transparent bits behind your cropped image. Easy to fix, though! Just go to Image –> Autocrop Image and voila, you have your automatically cropped image:

Results of gimp autocrop

Using a Script

The other option I found was this Post Rotate Crop tool. So I installed it (if you don’t know how to install scripts for Gimp, check out this post).

This one is meant to be run after any transformation – like rotate, perspective, scale and shear, so I went back to the original photo and rotated it again, this time with the Clipping set back to just Adjust, and then I ran the script, which is found under Tools –> Transform Tools –> Post Rotate Crop. I immediately fell in love with this script when I saw all the options:

oooh... OPTIONS!

Not only does it have the one thing I really wanted – Maximize by Height and width – but I can even input an exact aspect ratio in the text fields that are being covered up by the dropdown in that screenshot, and have it crop to that – so if I know I’m ultimately going to print an 8×10 photo, I can automatically crop it now! How cool!

Here’s the photo now with the maximum height and width picked:

Maximum Crop

Don’t think it looks much different than the auto crop I used in Gimp before? Well, it is! In this photo, I’ve shaded the area that the clipping using the rotate tool resulted in:

Difference between crops

As you can see, there’s a good number of pixels on the right that were saved using the Post Rotate Crop script.

The biggest downside of the script is the amount of time it takes to run (which really isn’t too bad, but it is longer than just doing the clipping in the rotate tool). Still, I plan on using it from now on.

By the way, after some additional editing, I ended up with this as my final version of that photo:

Photowalk 49 - Sunset over the ledges

In conclusion, I really love the Post Rotate Crop tool, and highly recommend it!

No related posts.

Related posts brought to you by Yet Another Related Posts Plugin.


  • Guest

    The Post Rotate and Crop link is changed; it is now http://registry.gimp.org/no... and includes a faster Python script.

  • Hi,

    I really like your blog for mainly a couple of reasons.
    1. I just found it (today as a matter of fact)
    2. You use GIMP (as I do)
    3. You talk about the plugins. (definitely want to know about those)
    4. You are not too technical
    5. I also love my Minolta 50mm 1.7

    I guess that's more than a couple of reasons.

    Anyway, I have subscribed to your feed! Please drop in to my blog sometimes.

    Thanks.

  • You should try the Straighten and Crop script (http://registry.gimp.org/no.... It's much faster than Post Rotate Crop and easier to use than native Gimp rotate tool. All you have to do is to draw a line along the horizon and it does the rest for you. It has pretty much the same configuration options as PRC.

  • skydvr

    Maciek - thanks for that info. i used the S&C script, and it was simple enough. It turns out that it depends on the PostRotateCrop script as well, so I needed to grab that as well (http://registry.gimp.org/no... - but perhaps that was due to the options I chose - I dunno.

    The funny thing was that I was struggling with this exact issue on the day that iffles posted this entry. Thanks to both of you!

  • donaldharper

    Nice! Thanks for this, and all the other great tips you have been working on. You have helped me in the few short weeks I have been reading your blog a lot!

blog comments powered by Disqus