Copy of base image/png code