adding some scaling for large images so they fit within the canvas