Compute width and height of image

The final two statements in Listing 2: