views:

1090

answers:

4

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

+17  A: 

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.

Joey
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?
Aaron Bush
Hm, I found the info on IE less valuable than the PNG specification as a hard source.
Joey
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:)
Aaron Bush
By the way, shouldn't you have linked to http://tools.ietf.org/html/rfc2046#section-6 as Content Transfer Encodings are not the same things as Media Types - the principle is clear, though ;-)
FalseVinylShrub
+4  A: 

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.

LeguRi
I prefer quoting the actual source, which, by the way, is linked directly after the quoted sentence :-)
Joey
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.
LeguRi
+2  A: 

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/

PeanutPower
+6  A: 

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.

FalseVinylShrub
+1. Nice find. I was merely guessing but didn't think of consulting the specification.
Joey
+1 Good info on IE!
Aaron Bush
Thanks for contributing to the quest for more reputation ;-)
FalseVinylShrub
I can confirm that IE is "x-png"ing them in IE8.
Aaron Bush