Reputation: 60819
Several photo management applications (e.g. Picnic on the flickr website, F-Spot on the gnome desktop), has the option to 'autocorrect'/'auto-fix' an image, which seems to adjust the colours in an image to make it look a bit better.
For example, here's a before:
Is there anyway to do this sort of 'automatically adjust the colours to make it look good' on the command line with ImageMagick's tools (or other open source command line tools on ubuntu/debian). I have several hundred images that look at bit rubbish and I want to try putting them through this sort of filter.
Alternatively, what would be the name of this sort of effect?
Upvotes: 12
Views: 9969
Reputation: 11382
GIMP has a feature Colors → Auto → White Balance, which works like this:
The White Balance command automatically adjusts the colors of the active layer by stretching the Red, Green and Blue channels separately.
Source: https://docs.gimp.org/2.10/en/gimp-layer-white-balance.html
This is also possible with ImageMagick:
Alternatively, you can normalize each channel as a separate image using the "-separate" operator (as of IM v6.2.9-2), then "-combine" them back into a single image again.
Source: https://www.imagemagick.org/Usage/color_mods/#normalize
With the following command, you will get pretty much the same result from ImageMagick as you would get from GIMP:
magick input.jpg -separate -contrast-stretch 0.5%x0.5% -combine output.jpg
Tested with:
$ gimp --version
GNU Image Manipulation Program version 2.10.22
$ magick --version
Version: ImageMagick 7.1.1-8 Q16-HDRI x86_64 d92cb0e65:20230421 https://imagemagick.org
Copyright: (C) 1999 ImageMagick Studio LLC
License: https://imagemagick.org/script/license.php
Features: Cipher DPC HDRI OpenMP(4.5)
Delegates (built-in): bzlib djvu fontconfig freetype heic jbig jng jpeg lcms lqr lzma openexr png raqm tiff webp x xml zlib
Compiler: gcc (7.5)
Upvotes: 7
Reputation: 15957
What you are looking for is something to help you correct the white-balance of photos.
If you search for imagemagick auto white balance
on any popular search engine you will get quite a feew results that are relevant. Sadly, http://www.imagemagick.org seems down at the moment.
I myself found a shell script called autowhite, and used it
me@sophie:[...]$ ./autowhite.sh 5498758807_59a80b3c50_m.jpg corrected.jpg
and the result is perfectly acceptable:
There are some options to the script, so if you're not really satisfied with the result you'll able to tweak it a tad.
Upvotes: 8