Use xrange in definition of pixel width