Assume an image file is sRGB under D65. Generate the image as it would appear under illuminant A ( a 171x1 matrix).
effect of illuminant:
B = LA
where A is the a color matching function, L is a diagonalized version of illuminant A, and B is the color matching function as a product of the illuminant. CMF's have the dimensions mxn where n is the number of primaries, and m is the sample count of the function. n is usually 3 because it's related to the 3 types of cones in the eye.
t = A'g
where g is the sampled spectrum, and t is the "tristimulus value". If using the color matching function for the CIEXYZ color-space, the tristimulus value has the form [X;Y;Z]. There are some manipulations to transform XYZ into other color-spaces (often utilizing a "white point", such as CIERGB, CIELab, etc).
The effect of the spectrum due to illuminant:
g = Lr
The Attempt at a Solution
I'm not sure where to really start here. I have sRGB with a white point D65, but since this is a tristimulus value, I really only know how to convert it to other tristimulus values. I could transform each pixel from sRGB to XYZ, multiply by the inverse XYZ CMF to convert back to a spectrum, adjust the XYZ CMF to account for the illuminant, adjust the spectrum for the illuminant, and use these to get a new XYZ tristimulus value, and convert back to sRGB...
The kink in that plan was that the CMF, A, is not square, so I can't take the inverse. So either there is some linear algebra magic I'm not seeing, or there is something I can do with this illuminant vector to the tristimulus values.