just wrote a fix for Grayscale jpegs not being displayed in pdf:
fixed grayscale JPEG
I was initially skeptical since grayscale images shown correctly in our live demo, then found it's Adobe Reader who gives a out of memory error when trying to open the pdf. So, good catch, thanks!
Thanks for merging so fast. Happy I could be of some help.