Home
Name Modified Size InfoDownloads / Week
shiftwb.c 2014-10-09 6.7 kB
README 2014-10-09 2.5 kB
LICENCE.txt 2014-10-09 35.1 kB
Totals: 3 Items   44.4 kB 0
SHIFT WHITE BALANCE UTILITY
Copyright 2014 Andreas Soupianas.
Licence: GPL

This is a simple utility for photographers to shift white balance of jpeg images taken with nikon
cameras and perhaps other brands too.

When we use raw format we can specify the white balance color temperature.
However when we shoot jpeg, if we select the wrong white balance it is not so easy to fix later.
This utility is based on a test, and the data it uses are extracted from photographs taken
with various Kelvin temperature white balance settings.
Nikon cameras write exifdata on jpeg specifying the Red and Blue Balance. The utility can extract
these numbers if exiftool is installed.

REQs:
C compiler.
cjpeg & djpeg to read and write the jpegs.
exiftool if you want to read inkelvin from the file (not needed but helpful).

COMPILE:
cc shiftwb.c -o shift_wb

INSTALL:
copy shift_wb somewhere in your path

USE:
shift_wb inkelvin infile outkelvin outfile [clipscale]

If you know what color temprature you used when you took your photograph, thats what you put as
value for inkelvin.
If you dont know the color temperature you used, you can specify f and shift_wb will try to 
extract that information from the jpeg file through exiftool.
If you dont have exiftool, you should look at the file exifdata and figure it out.
This table is an approximation of what is used on most cameras:

Name	Temperature in Kelvin
Sunny		5300
Cloud		6000
Shade		7200
Tungsten light	3000
Fluorecent	4000


infile is the name of the jpeg file of your photograph.

if you know the color temperature that you should have used when you took your photograph, that
is what you put as value for outkelvin. You have to know the color of the light that was there.

outfile is the name of the jpeg file that will be created. If you want to save to ppm instead
of jpeg append a .ppm extention to the filename, eg name it outfile.ppm instead of outfile.jpg

Normally the ulitily will simply scale red and blue values, and clip anything out of limits.
That means that either red or blue values may clip, creating blown colors instead of blown whites.
If you want to clip/expand all color channels, specify an extra parameter clipscale.
You can use any name, clipscale is only a suggestion, and this behavior will be activated by the
presence of a 5th parameter alone. 
This will probably output a brighter image with clipped highlights (unless the original was 
underexposed enough to keep information of all three channels). That means, of course, that
more information will be discarded 
Source: README, updated 2014-10-09