Logic was wrong for selecting the image width.