A bit more progress on the PNG reading function.