alternate way of getting image's dimensions

Should fix #45 if @Huji is correct.

(See #45 for details.)