How can I determine the extreme color values in a texture? I am looking for a way to determine the most extreme color values for all of the texels in a texture. So for a texture consisting only of black and white texels, the extreme values should be (0,0,0) and (1,1,1) expressed in RGB format. For a color gradient from red to green I should get the values (1,0,0) and (0,1,0). Now obviously I could do this on the CPU by iterating over all the pixels texels of the texture and keeping track of the color values found to be most apart from each other, but this is probably relatively slow, so I am looking for a way to do this using the GPU shaders. Is this possible using shaders? I am not experienced with GPGPU, so a solution in HLSL GLSL would be preferred. Or maybe there is a fast algorithm I could use on the CPU?