56

When I click on an image link right now, Chrome downloads the image instead of opening it.

Even if I right-click and select Open link in new tab Chrome still downloads the image, and I have to go through the extra steps of opening the file for viewing manually.

This feels like a mime-type issue to me, but why would Chrome not recognize "image/png" as a valid mime-type for viewing? All PNG images display just fine in an HTML page.

NOTE: This only happens for PNG images.

vvvvv
  • 25,404
  • 19
  • 49
  • 81
Robusto
  • 31,447
  • 8
  • 56
  • 77
  • I use chrome a lot and arre you talking about wwhen you view an image on line like http://www.butterflyutopia.com/wall4.jpg then click on it the above happens, as nothing happens for me on click and I can open in anothe rtab, have you got an EG to show etc – Simon Davies Feb 01 '12 at 14:49
  • @SimonDavies: That one opens for me, but it's a JPG. If I try to open a PNG, like one of the two images shown on [this Adobe bug-tracking page](https://bugs.adobe.com/jira/browse/SDK-32051), it downloads them instead. – Robusto Feb 01 '12 at 14:58
  • its cause its surrounded in a link tag, if you right click and select further down from the 'Open Link....' and choose 'Open image in new Tab' this should then do as it says. – Simon Davies Feb 01 '12 at 15:03
  • @SimonDavies: That's one of the problems, as I mention in my 2nd paragraph. If I right-click and choose "open link in new tab" it starts to open the image in the new tab, then closes the new tab immediately and downloads the image instead. – Robusto Feb 01 '12 at 15:05
  • Thats why i said use the 'Open image in new Tab' that is a bit further down from 'open link in new tab', on the right click drop down, not 'open link in new tab' as you mentioned – Simon Davies Feb 01 '12 at 15:17
  • @Simon: Ah, I've been clicking on the link, not the image, which is why I was not seeing that dialog. Thanks, this works. If you want to enter this as an answer, I'll accept it. – Robusto Feb 01 '12 at 15:34
  • I have similar problem. But in my case chrome opens png with `Content-Type:image/png` in `Response headers` and downloads png with `Content-Type:image/x-png`. I think that problem with associated mime types. – akaRem May 13 '12 at 05:31
  • @Tom Clift is right, and here is my [workaround](http://stackoverflow.com/a/12235918/1082681) for it. – kriegaex Sep 02 '12 at 13:19
  • possible duplicate of [How can I edit Chrome MIME type mappings?](http://stackoverflow.com/questions/8323946/how-can-i-edit-chrome-mime-type-mappings) – demongolem Apr 23 '14 at 20:03
  • This happens to me with i.e. twitter's jpegs where after I cancel their save a popup would appear and ask "File downloaded?" on which after clicking ok (and it's blocking) the tab would usually close. Changing the format param to png rather did help to not have it close – elig Dec 04 '20 at 04:09

5 Answers5

23

The web server is probably serving the image using the image/x-png MIME type. Chrome does not recognise this as an image (as of August 2012 February 2013), hence offers the file as a download.

image/x-png is a legacy MIME type from the days before it got its official name, image/png, in 1996. However, when Internet Explorer uploads an image it does so using image/x-png "for backward compatibility". I believe this was the case up to IE8, and was "fixed" in IE9. If the web server does not correctly handle this (the web server should detect this non-standard MIME type and treat it as image/png), then it may serve up the client-provided MIME type to other users, including to Google Chrome. Additionally, some web sites will serve up all PNGs as image/x-png.

If you're the web developer you should detect incoming image/x-png and treat it as image-png (never serve up image/x-png).

If you're the user report it as a bug and see @kriegaex's answer for a workaround.

Community
  • 1
  • 1
Tom Clift
  • 2,365
  • 23
  • 20
16

@Tom Clift is right, and here is my workaround for it: use Chrome extension Redirector and add a rule replacing the Content-Type header. That's it. :-)

Community
  • 1
  • 1
kriegaex
  • 63,017
  • 15
  • 111
  • 202
  • 2
    Replace that header with what? – Nate Jun 28 '19 at 04:23
  • Maybe you should just follow the link and read my other answer. ;-) There you can see the replacement rule for _Redirector_. Besides that, the accepted answer here also explains what needs to be replaced. – kriegaex Jun 28 '19 at 04:48
4

You can use the Chrome extension Undisposition to achieve this.

David Salamon
  • 2,361
  • 25
  • 30
0

In addition to @Tom Clift's response, also, check the Content-Disposition header in the server response. If the value is inline, the content will be opened in the browser, and if the value is attachment, the content will be saved to disk.

tolache
  • 168
  • 1
  • 1
  • 12
-3

When you right click on the image you need to select then 'Open image in new Tab' from the drop down and NOT 'Open link in new tab' this will then open the image in a new tab.

Simon Davies
  • 3,668
  • 9
  • 41
  • 69
  • 4
    You suggest to right-click on every image? This is not a solution. – akaRem May 13 '12 at 05:06
  • 1
    This option doesn't exist in the dev tools. There is only 'Open link in new tab' – gtournie Mar 10 '17 at 01:23
  • When I right-click an IMAGE LINK, there is no option to "Open image in new tab" only "Open link in new tab" which wants to download the PNG file instead of displaying it. The option "open image in new tab" only appears for rendered images on the page, not for links to images. – Nate May 17 '19 at 18:02
  • This answer seems to misunderstand the issue. Often a site will show a scaled-down version of an image that is linked to a full-size version. When you click the image, Chrome will offer a download (bad) instead of showing the full-size image (good). If you do what this answer prescribes, Chrome will show the *thumbnail* version in a new tab, which probably won't help. – Patrick Dec 11 '19 at 18:23