Implemented jpeg read support (still a bit dirty too).