Damn, okay... Well I figured to just use palette based images for all PNGs (given they are screenshots anyway).
imagecopyresampled($out, $tmp, 0, 0, 0, 0, $neww, $newh, $oldw, $oldh);
This does not work right, $out is the new images made from imagecreate(), and $tmp is the image made from imagecreatefrompng().
Since $out is a palette image and $tmp is a truecolor, it is just showing a black image all the time. How can I convert $tmp into a palette based image?