Qnx widget file image format

Im developing an utility to correctly convert PhAB 1.14 → 2.01 widget files. I have figured out the file format of the widget files. My only problem is that when there is image data in the file I dont know the size of the image data and it doesnt use the method as everything else to signify the data is terminated. I dont need to manipulate the data in anyway all I need for now is how to work out the size of the data. Does anyone know what format image data is stored in wgtp files?