That's not how it works.
The server declares what versions of media it has, and the client requests a supported media format. The same trick have been used for audio and video for ages too.
Example:
<picture>
<source srcset="a.webp" type="image/webp">
<img src="fallback.jpg">
</picture>