Easy to use code for libpng