Create a .png image file?

Is it possible to create a simple image file using tools like iOSGraphics has? (line, rectangle, fill, text)
I would like to be able to save this as a .png and email it or save to pictures etc. (to use the iosGraphics), get from that a iosImage (image property) the method writeToFile

This worked great! Thank you!

Another question…
Is there a way to send this file directly to the Mail app?

Currently this saves the file as a .jpg
How can I specify a .png file to be saved?$WriteToFile
specify a different type like public.png