Just so you are aware, QImage supports only 1, 8, and 32 bit formats. So AFAIK, your only option is to do it manually.

Bojan