converted code to emit binary .png files