Segfaulting on png writing.