writing to a file and creating a texture

Writing to a PNG file and then reading it back into a texture.
Trying to go straight from data