def topngbytes(name, rows, x, y, **k):
 import os
 print name
 f = StringIO()
 w = Writer(x, y, **k)
 w.write(f, rows)
 if os.environ.get('PYPNG_TEST_TMP'):
  w = open(name, 'wb')
  w.write(f.getvalue())
  w.close()
 return f.getvalue()

def topngbytes ( name , rows , x , y , ** k ) : import os print name f = StringIO ( ) w = Writer ( x , y , ** k ) w . write ( f , rows ) if os . environ . get ( 'PYPNG_TEST_TMP' ) : w = open ( name , 'wb' ) w . write ( f . getvalue ( ) ) w . close ( ) return f . getvalue ( )
convenience function for creating a png file "in memory" as a string .