QT4 windows

I would like to save an image file (jpg,bmp...) into an sqlite database as a BLOB. What format must it be in to save it to the database? I can't find anything that converts into a ByteArray.

Once that problem is solved I will then have to view the image form the database. So whatever format i save it in I will have to be able to put it back into QImage or QPixmap.

Thanks.