Suggestions for automating quick color correction

Questions and postings pertaining to the usage of ImageMagick regardless of the interface. This includes the command-line utilities, as well as the C and C++ APIs. Usage questions are like "How do I use ImageMagick to create drop shadows?".
Post Reply
michaelmahoney
Posts: 7
Joined: 2014-02-01T07:25:31-07:00
Authentication code: 6789

Suggestions for automating quick color correction

Post by michaelmahoney »

I'd like to add some quick, reliable color/contrast/brightness correction to a process that runs through many images for web use, without requiring input from me.

I have a batch file that runs IM to convert large numbers of files for a web site. I can do just about anything successfully that can be expressed mathematically- resize, convert formats, unsharp, etc. but there are two problems when it comes to color correction using PaintShop or similar. First, it requires me to open the file, click some stuff, save the file, etc- too time consuming considering the numbers of images. Second, I have a fairly severe red/green color vision deficiency. Even if I use the more sophisticated suggested settings, I'm worried that I'm making luridly weird images. Realizing that images are very different, I'd still much rather have IM do a basic but reliable job automagickally.

I'm getting images that are often taken with camera phones in less than ideal conditions, and even I can tell that many of them could benefit from some correction.

The main problem is backlit subjects: (generally swimmers either in pools or open water, cyclists against bright landscapes like mountain overlooks, and runners in weirdly-lit fieldhouses or shaded trails.)

Anyone have any suggestions that would make some improvement in just about any image? It doesn't have to be perfect, but even a 50% improvement would be helpful.

I'm trying -normalize and similar now, but obviously I'm not sure of my results.

Much thanks!

Mike
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: Suggestions for automating quick color correction

Post by snibgo »

Hmm, interesting problem, especially being compounded by your eyesight!

Identifying back-lit photos shouldn't be hard -- a dark portion surrounded by light could be labelled as "back-lit". But what happens then? You could isolate the dark central portion, and apply an automatic white-balancing to that.

A number of methods are available for automatic white-balancing:

1. The average of all the pixels should be a neutral gray. This obviously fails if the photo is of just green grass.

2. The brightest non-clipped pixel should be a neutral gray. Many cameras work this way, and is surprisingly (to me) often successful. Eg if the brightest pixel is (245,260,230) then multiply all pixels by (260/245,1,260/230).

3. Identify an object in the photo that should be neutral gray (or some other colour) and adjust accordingly. This is difficult, unless you have face-identfication software.

Possibly the photos you see have already been through method (2) which has failed simply because the camera has balanced the wrong pixels.
snibgo's IM pages: im.snibgo.com
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Suggestions for automating quick color correction

Post by fmw42 »

If you are on Linux or Mac (or Windows with Cygwin), you could try some of my scripts at the link below.
Post Reply