A: 

It looks like you're taking input that's meant to be RGB and treating it as RGBA (32-bit bitmap instead of 24-bit).

Jerry Coffin
+1  A: 

One of the most common causes of the left image is a buffer that is not properly aligned.

I believe Windows expects a DWORD aligned buffer.

One issue I see with the above code is that you do not want to use winRowSize to copy the actual pixels, you want to use a variable with the (width of the image * bytes per pixel). winRowSize copies the DWORD aligned size which is probably too big (although some images may work as they fall on DWORD alignment by default.)

Change the for loop:

        for(i = 0; i < (width of the image * bytes per pixel); i++){ 
           rawImage[location++] = row_pointer[i]; 
        }

(You may also have to adjust the rgb to bgr code.)

You beat me by 1 minute but you forgot to mention that DWORD alignment is needed for each row not just for the beginning of the buffer.
Windows programmer
Thanks for that catch, But that didn't solve my problem.
zipcodeman
Thank you. I fixed the RGB/BGR converter.
zipcodeman
Instead of converting the entire image from rgb to bgr, try doing it per scanline and again use (width of image * bytes per pixel). Once that's done if it still doesn't work, try posting your modified code.
Ok, glad to see it worked.
A: 

Maybe you forgot to pad each row of pixels to occupy an integral number of DWORDs.

Windows programmer
I did that. It helped with each line being shifted over, but not the color problem.
zipcodeman
A: 

maybe the problem jpeg is not is rgb, but is cmyk instead (or even grayscale). not all jpegs are rgb.

PS, (yes I know jpegs are not actually rgb - are yuv instead, just trying to keep this answer simple)

steelbytes