I've read that there is about 1 man-year's worth of work to create a jpeg encoder/decoder.
Must you use C, or can you use C++?
GdiPlus(C++) will allow you to open/save files with a small addition of code to your project. This is a included part of Windows since XP. (gdiplus.h gdiplus.lib)
Steps:
- Create gdiPlus::Bitmap, load it with your image file
- Create a HBITMAP from this bitmap
- GetDibBits on this HBITMAP
- Clean-up result, removing padding bytes (if present) from end of each scan-line.
Note: init/shutdown of gdiPlus ommited for brevity
Failing that, you may choose to review jpegLib (dunno if it's c or c++)