Post Reply 

Automatic Rotation and Cropping

Oct 23, 2012, 13:47
Post: #1
Automatic Rotation and Cropping
Question from the stamp collecting world.
I have many scanned images of my collection and need to automate the process of rotating the image so that it is "square" and then cropping to remove unwanted background.
I have learned GIMP enough to do this manually with the rotate and crop tools but I have 1000s of images so would appreciate any tips to automate this process.
Thanks!
Find all posts by this user
Quote this message in a reply
Oct 23, 2012, 15:47 (This post was last modified: Oct 23, 2012 15:49 by rich2005.)
Post: #2
RE: Automatic Rotation and Cropping
(Oct 23, 2012 13:47)Mekon Wrote:  Question from the stamp collecting world.
I have many scanned images of my collection and need to automate the process of rotating the image so that it is "square" and then cropping to remove unwanted background.
I have learned GIMP enough to do this manually with the rotate and crop tools but I have 1000s of images so would appreciate any tips to automate this process.
Thanks!

There is a deskew plugin for Gimp, from some time ago, the authors web site is now gone, although the source code is still available.
I have this compiled in linux but for windows all I have is the win-32 archive from a few years ago. I have just tried it in a WinXP + Gimp 2.8 and it works there but no real guarantees. Unzip, pop into your local .gimp-2.8\plug-ins folder and try, should show under filters -> misc.
There is a batch application BIMP but I can't get deskew to work with that, so AFAIK the best in Gimp will be image-by-image, apply deskew, then crop.
A possibility is a script 'divide scanned images', it uses deskew and might just work with individual stamps, or even a few scanned together,
http://registry.gimp.org/node/22177
( edit: I see RobA has included the deskew plugin so you don't need mine)

For automatic it is back to Imagemagick & if you don't want to write a batch file you can apply IM deskew to a whole load of files in a folder, then apply an 'auto-crop' that sort of works. IM deskew is a bit tempremental, ok up to 5 deg off vertical. the 90% parameter refers to background colour.
example - no stamps, first thing that came to hand.
[Image: BCYcz.jpg]

You would really need to check out the IM documentation, copious but often reads like sanskrit.


Attached File(s)
.zip  deskew-win32-1.1.0.zip (Size: 21.5 KB / Downloads: 271)

** https://www.gimp-forum.net/ now answering questions**
Find all posts by this user
Quote this message in a reply
Oct 24, 2012, 11:43 (This post was last modified: Oct 24, 2012 12:06 by rich2005.)
Post: #3
RE: Automatic Rotation and Cropping
More than a few trials with a scanned image of a postage stamp and using deskew both Gimp and Imagemagick fail if more than a couple of degrees off vertical. In fact I found that deskew might make the out-of-plumb worse.

So, I can't find any real way to batch convert images by straighten then crop.
Hopefully someone will come up with ideas.

You might improve your workflow for individual images with a couple of scripts.

Auto-rotate http://registry.gimp.org/node/22910
and the one previously mentioned
Divide-scanned-images http://registry.gimp.org/node/22177
but it is very sensitive to settings.
If installed take deskew out of plug-ins so that it is not found. Both the above are scripts and go in your local gimp folder .gimp-2.8\scripts.

A little video of use. http://youtu.be/eo7QM1N2P4w 2 mins.

edit: looking at that again, no real benefit in divide-scanned-images over a regular crop.

** https://www.gimp-forum.net/ now answering questions**
Find all posts by this user
Quote this message in a reply
Oct 25, 2012, 02:30
Post: #4
RE: Automatic Rotation and Cropping
Thanks for the responses here. It may be a bit more than my current capabilities so I will get down to studying.
Find all posts by this user
Quote this message in a reply
Post Reply 


Possibly Related Threads...
Thread: Author Replies: Views: Last Post
  Cropping but selecting stuff to discard, not keep. seanspotatobuisness 1 319 Jul 14, 2017 18:46
Last Post: ythgilb
  image cropping to a pre-selected size geomcd49 1 414 Oct 1, 2014 04:42
Last Post: fluffybunny2
  Multiple Resizing, Oval Cropping and Watermarking ermns 9 544 Sep 30, 2014 02:18
Last Post: ermns
  trouble cropping active layer bugsinherteeth 5 474 Sep 4, 2014 20:37
Last Post: fluffybunny2
  Automatic color adjustment goldnsilva 1 348 Aug 20, 2014 12:05
Last Post: rich2005

Forum Jump:


GIMP ForumPortalArchiveContactTermsRSS