put png packing into a function, make it parallel.
Introduce a MAX_CORES variable.