I'll give you an answer to this question sometime later today, hopefully, after work. In the meantime, I have to ask why you don't just use a targa (.tga) image instead of your own custom format? DOT has built-in support for tga images, so you would be saving yourself some bother.