improve image dimension stuff