Add proper calucation for loaded and set image dimensions