Set png format before allocating memory to ensure that buffer size is properly determined. Also remove 0_boot hacks