1

When I have an image URL for a jpg or png image, for example:

https://static.coingecko.com/s/coingecko-logo-d13d6bcceddbb003f146b33c2f7e8193d72b93bb343d38e392897c3df3e78bdd.png

When I visit this link, it shows me the image. When I right click the image and 'Save Image As...' for some reason it insists on saving it as a .webp (Google WebP) image.

It's not just a matter of renaming the extension, the file it downloads and saves is actually a webp image.

No matter what I do, I cannot seem to get my browser to just save it in the native format I'm visiting, i.e. png or jpg (in this example, png).

This happens in any browser: Chrome, Firefox, Brave, Chromium, et cetera.

Note that when I do curl <theurl> from the terminal, I am getting the correct image file.

And when I build a custom script to inspect the HTTP headers, it has the correct mimetype (image/jpeg or image/png). This makes me think that apparently, full browsers (not just some curl script) send some Accept header or something, that causes the particular webserver to output a webp image instead of the png or jpg, regardless of whether the URI specifically requests the png or jpg.

I'm sure there is some rational reason for this behaviour but I don't want it. Is there a way to fix this?

4
  • 1
    maybe this will help you 6 Ways to Save WebP Images as JPG and PNG – Zina Apr 24 '20 at 20:44
  • 1
    The response headers: content-disposition and content-type as you can check in the Dev tools are what's influencing the browser. If you put ?a=1 at the end of the URL, then the content-type response header is set to image/png and the content-disposition header is dropped. It's really down to the logic behind how the server responds to the request. – HelpingHand Apr 24 '20 at 20:53
  • @Zina Thanks, however unfortunately the first method doesn't work for me (perhaps that was written with only a specific website in mind?) and the other methods are, well, suboptimal for different reasons. – RocketNuts Apr 24 '20 at 21:18
  • @HelpingHand Thanks, that seems to do the trick! Apparently the webserver decides that it has a webp version of some image I'm requesting, and then feeds me the webp instead. However by adding ?a=1 or ?random=6718495 I'm requesting a 'unique' image of which only one version (the jpg or png) resides on the server. Although surely some webserver logic may reduce it to just the filename and still replace it. However in all cases where I ran into this problem (on multiple servers/domains) this handy quick method seems to work fine everywhere! – RocketNuts Apr 24 '20 at 21:20
4

You would need to switch the browser's user agent setting. If the web server recognizes an older browser incapable of webp, it should give you png.

3
  • Thanks for the suggestion but to be honest that feels like a rather dirty hack, not to mention inconvenient. This means I'd have to change the user agent every time I wish to switch between webp support enabled or disabled. I can see how this works though, however for now I'll prefer the suggestion from @HelpingHand's comment that feels more like a direct, in-place fix. – RocketNuts Apr 24 '20 at 21:17
  • Is it testing your own server what you are doing? Why otherwise would you want to download the same file in different formats? If you want to test with an older browser, then why not with Internet Explorer directly? – Furty Apr 24 '20 at 21:41
  • No it's not my own server (I have never used webp anywhere so far). And no I don't want to download the same file in different formats. I only want to download it in the regular format that is also in the URL, i.e. jpeg or png. My problem is: some webservers obnoxiously keep giving me a .webp image even if I'm explicitly requesting a jpg of png image. – RocketNuts Apr 24 '20 at 21:59
0

This is not really a web browser thing, but a web server thing. When the browser says it can handle webp images, some (allas: many) servers send webp images, even when the url would suggest it is a jpg or png image. The browser then displays and saves what it gets: the webp image.

The easy way around this is: copy the image url (many browsers have such an item in the right click popup menu), and use a program like wget or curl to download the image:

wget http://huppeldepup.png

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.