numPixels would be a much simpler name for this variable. 

No point in calling Math.ceil() here.  I think it would be a good idea to use ceil() or floor() on the threshold computations below, however.