Fixed calulcation of binary image size