fix code for writting png files

Change-Id: I96244b99b2f5a9f22ca09c133687661b06229359
ahh, think error

Change-Id: I400115ad802c1d00ec5f99e4f5fc952938de450a