scale an image css

CSS
<!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>                     

Source

Also in CSS: