What is the difference between "image/png" and "image/x-png"?
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.
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.
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
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.