Check out example codes for "CSS shrink image". It will help you in understanding the concepts better.

Code Example 1

<!DOCTYPE html> 
<html>  
    <head>  
        <title>cell padding</title>  
        <style>  
            .gfg { 
                width:auto; 
                text-align:center; 
                padding:20px; 
            } 
            img { 
                width: 100%; 
                height: 100%; 
                object-fit: contain; 
            } 
        </style>  
    </head>  
    <body>  
        <div class = "gfg"> 
                <p id="my-image"><img src= 
"https://media.geeksforgeeks.org/wp-content/uploads/geeksforgeeks-17.png"> 
            </p> 
        </div> 
    </body>  
</html>                    

Code Example 2

squareImage {
  border: 1px solid #ddd;	/* thickness and color of border */
  border-radius: 4px;		/* edge rounding of border */
  width: 150px;				/* width of image (px or % or auto) */
  height: auto;				/* height of image (px or % or auto) */
}

Code Example 3

<div style="width: 200px; height: 200px;">
<img src="imagen\imagen1.jpg" style="width: 100px; height: 100px;"/>
</div>

Learn ReactJs, React Native from akashmittal.com