An image can be set to automatically resize itself to fit the size of its container.
If you want the image to scale down if it has to, but never scale up to be larger than its original size, use the w3-image class.
Resize the browser window to see the effect.