This: double ratio = bb.width / bb.height; Appears to be doing integer division, I switched to: double ratio = (double)bb.width / (double)bb.height; and got what I expected.