Crude but effective PNG export code