Very confusing post. Are you talking about image manipulation? Or programming an image to perform PHP functions (which technically is probably impossible as PHP functions are interpreted by PHP and images are interpreted as HTML markup by Apache.)
You want a JPG/PNG image not a PHP one??? Images ARE JPG or PNG or GIF (etc etc), that is their formatting.
I think you need to be more clear about your question.