What is the difference between "image/png" and "image/x-png"?
Asked Answered
D

4

76

What is the difference between "image/png" and "image/x-png"?

Dogma answered 18/1, 2010 at 13:45 Comment(0)
S
61

The x- prefix is given to non-standard MIME types (i. e. not registered with IANA). So I assume that image/x-png would have been PNG before the MIME type was standardized.

6.3. New Content-Transfer-Encodings

Implementors may, if necessary, define private Content-Transfer-Encoding values, but must use an x-token, which is a name prefixed by “X-”, to indicate its non-standard status, e. g., “Content-Transfer-Encoding: x-my-new-encoding”. Additional standardized Content-Transfer-Encoding values must be specified by a standards-track RFC. The requirements such specifications must meet are given in RFC 2048. As such, all content-transfer-encoding namespace except that beginning with “X-” is explicitly reserved to the IETF for future use.

RFC 2045 — Multipurpose Internet Mail Extensions, Section 6.3

This is also documented in the PNG specification. See FalseVinylShrub's answer.

Subversive answered 18/1, 2010 at 13:49 Comment(4)
I'm accepting this answer because it's more complete. But could you fold in FalseVinylShrub's info on IE so it's all in one place?Dogma
Hm, I found the info on IE less valuable than the PNG specification as a hard source.Subversive
Lol that's because you aren't trying to figure out why all the pngs are coming from the same company, but only one user is uploading them as X-Pngs:)Dogma
By the way, shouldn't you have linked to tools.ietf.org/html/rfc2046#section-6 as Content Transfer Encodings are not the same things as Media Types - the principle is clear, though ;-)Dougall
D
25

According to http://www.w3.org/TR/PNG/#A-Media-type

The internet media type "image/png" is the Internet Media Type for PNG [RFC-2045], [RFC-2048]. It is recommended that implementations also recognize the media type "image/x-png".

So, if you're delivering or uploading a PNG image, 'image/png' is the correct one to use. However, if you're accepting uploads or otherwise interpreting the media type, you are recommended to accept either.

By the way, I found a reference from 2008 that Internet Explorer (version unspecified) was uploading PNG images with a type of image/x-png, so this was a real issue for someone as recently as that.

Dougall answered 18/1, 2010 at 13:55 Comment(1)
I can confirm that IE is "x-png"ing them in IE8.Dogma
S
6

According to Wikipedia's article on Internet Media Types, and the article it cites...

Types or subtypes that begin with x- are nonstandard

So my guess is "image/x-png" is probably leftover from the days when png was pretty new, and as such, not standardized.

Subplot answered 18/1, 2010 at 13:50 Comment(2)
I prefer quoting the actual source, which, by the way, is linked directly after the quoted sentence :-)Subversive
Actually that's a citation, not a quote... the original RFC doesn't contain the words I quote ;) but I dig what you mean, and added a link thereto.Subplot
C
6

image/x-png was the type before PNG was accepted by the IANA as an official mime type.

http://www.iana.org/assignments/media-types/image/

The official image/png MIME type for PNG, approved on 14 October 1996

http://www.w3.org/Graphics/PNG/

Counteroffensive answered 18/1, 2010 at 13:52 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.