How do I convert an image to hex for use with ~DG ZPL code?

I am using the Zebra SDK with Java on Android.

 

I need to print an image as part of a receipt-type printout, but the only references I can find in the SDK documentation is for printing just an image.  ie. printer.printImage(); in the GraphicsUtil example  But I would like to convert an image for use while sending raw ZPL to the printer.  How would you recommend I accomplish this?  Should I be skipping ~DG altogether and use printer.storeImage(); and then use ^XGFILE.GRF,1,1 in ZPL?

 

Thank you very much!