Use custom PNG output code

Replaced the use of ImageIO for saving snapshots with custom PNG writing
implementation. This may or may not improve PNG output capabilities.

see #274 (github)