Adding fit method to fit an image to specified dimensions