Reworked public IO API. Added PNG optimization.