It should not be converted to utf-8. PNG is a binary format and
therefore write() needs bytes (as returned by struct.pack).
Do you have a short example that produces the error? Saving a image
with the PNGImageEncoder works fine for me with Python 3.2.
I guess you are incorrectly opening the file in text mode, either by
specifying an encoding like utf-8, or you forgot to open the file in
binary mode.
Regarding the new pypng version, as far as I know it doesn't work as a
drop in replacement, because the version embedded in pyglet has some
pyglet specific changes. As pyglets version is quite old, I guess that
rebasing those changes would be quite some work.