Archives for 

tools

How to Auto Crop Bulk Photos to a certain aspect ratio?

I read this question on photo.stackexchange.com on how to auto crop images to e.g. 4:3 format e.g. to the format 1000×750.

This reminded me of an age old problem: you can of course auto crop images to always 4:3 / 1000:750 manually or automatically:

image

There are zillions of software tools that let you automate this stuff , I usually use Irfanview for my bulk processing.

But… if you would automate this by e.g. putting the crop always in the middle of the photo (instead of starting at 0:0) it could well be that you miss out a part of the photo that you really want to keep in that crop.

For the regular house-garden en kitchen personal photo’s: this will not be a problem. Since you will be the end-user and in the end : who cares? But for a more professional process you will somehow need to determine if there are certain details in a picture you want in the end result before cropping or better said: to determine WHERE to crop.

For any photo’s that are “near” the aspect ratio : probably there is no problem but the farther you go away from the aspect ratio the worse the results will turn out.

image The photo on the left is 200 x 1000 ( width=200 and height= 1000). If I would use the simple batch algorithm above, the resulting image would look like on the right image

So … as you can see in the example above: our algorithm is not that nice: we do not even have the giraffe on the image.

Our customer would not be happy if there was not even a giraffe on the picture.

So we could do several things:

  1. Have some content based image recognition software that determines the most important parts in the image and takes this as “the middle” of the crop area (and hope we catch everything)
  2. If we are outside a certain range of the 640×480 range (lets say 10%) then no longer do an auto crop but “fill” the remaining area with a background color
  3. If we are outside a certain range of the 640×480 range (lets say 10%) then no longer do an auto crop but use some smart image tools to “create” a fill-in for the remaining part of the image.

Option 2 is easy and we can do this with most photo batch processing tools (see thread on stackexchange)

But what about option 1 and option 3? Which software can I use to batch process large amounts of photo’s to perform either 1 or 3 ?

tip: webserver voor on the road: the Uniform Server

Tot verleden week had ik MicroApache (http://microapache.kerys.co.uk/) in een folder in “mijn” Dropbox. Best handig om af en toe een webservertje te hebben om wat scriptjes tegenaan te draaien of apps zoals dokuwiki. Maar nu vond ik The Uniform Server (http://www.uniformserver.com/), zelfde principe: een webserver die je los op een usb stick of een dropbox folder kunt plaatsen maar met het verschil dat the uniform server waanzinnig veel meer zaken ondersteund (zoals Java apps in e.g. TomCat) en eigenlijk als een “echte” webserver kan draaien. Handig. MicroApache exit, enter Uniform Server.

p.s. er zit ook een vrij handige admin gui tool bij.
p.p.s. op mijn vaste thuisplek heb ik Zend Server Community Edition draaien (http://www.zend.com/en/products/server-ce/index) omdat het natuurlijk wel handig is om e.g. mijn php code live te debuggen vanuit Eclipse.