First of all let me say I know white balancing a JPEG file or any processed image in general is not a new idea.
I simply wanted to apply the theoretical concepts about linear edition and white balance to try to correct a wrong white balance obtaining a result as close to what we would have obtained if the image had been properly white balanced at RAW development, without leaving Photoshop.
White balance implementation is actually an exposure correction of at least 2 of the RGB channels of the image, so I will just convert the wrong white balance image into a linear profile and individually correct exposure of the RGB channels to correct it. In the end the image will be again de-linearized for proper additional edition.
We start from a crazy white-balanced image (JPEG):
1. Convert image to 16 bits to avoid shadow posterization in the next operations
2. Linealize the image from the currect colour profile to some linear profile (linear versions of common profiles can easily be generated just by setting gamma=1.0 in PS). Find here linear versions of both sRGB and Adobe RGB.
3. With a curve mask layer, we set the white point in any neutral (R=G=B ) area of the original scene. This is a weak point of the method since not all images have truly neutral elements; in those cases some manual trials will be necessary.
In my image I took the white wall in the background:
4. To avoid the burnt areas that the curves produced, we create another curve mask layer and set it between the image and the curve mask layer created in the previous section:
This new curve will be another straigt line to reduce exposure until we get no burnt areas:
5. The last action will be put all layers and image together (CTR+E) and convert again to the desired output profile. This will gamma correct again the image and this is needed since Photoshop is not adequate for linear edition.
The image will now be properly white balanced and ready to be edited to get the best of it:
Explained with more detail in (Spanish): BALANCE DE BLANCOS JPEG.
(Added) I have to say that it is actually not necessary to convert to a linear profile to apply the procedure, since any scaling factor f can be extracted from the exponential gamma term, to be a scaling factor again: (f x rgb)^(1/g) = f^(1/g) x rgb^(1/g)
So only sRGB which has a non-pure gamma curve applied must be first converted to some other colour profile with a pure gamma (Adobe RGB for instance would serve well).
BR