How can I extract a jpeg from a p2m appearance file?

I am trying to recreate textures from a SolidWorks model while importing the model into another program that uses OpenGl for rendering. My question is how can extract a jpeg from a .p2m file so that I can use the jpeg to render textures via OpenGl.

Thanks,
Mani

SolidworksApi macros