simplified image width/height code