get rid of slow getPixel code