fixed grayscale JPEG

Hello,

just wrote a fix for Grayscale jpegs not being displayed in pdf:

See http://pastebin.com/HqjM91Be