The best option to create a png image is the zlib library, because a png file obeys to the zlib standard. It has multiple implementations in various programming language too and you can set the compression level.