If max_size is too large relative to max_reso, it will calculate a height of zero for some buckets.
This causes a crash later when it divides the width by the height.
This change also simplifies some math and consolidates the redundant "size" variable into "width".