The whole thing appears to be a hack, though; we should really be using the image dimensions from the file info.