initial logic to get image data