anybody know how to work out how big to make a window based on the size of an image in pixels?

i thought that if you set a windows size to be, say, 200x200, and then displayed a 200x200 pixel image, the image would fill the window perfectly... unfortunately this doesn't seem to be the case... is there a way to calculate how big to make a window based on the number of pixels in an image?