Re:Firefox 85
by thayne on Tuesday January 26, 2021 @12:00PM
(#25918199)
image/png is only one of many types of images though.
[ Parent
| on HN ]
If the point is a copy-paste raster image that shall be understood by most other programs, then image/png is a fine choice, as it is lossless and well-known.
> If the point is a copy-paste raster image
There are other use cases though that aren't supported by PNG, such as vector images and animated images. Or more niche use cases like RAW images.
Vector images don't really need direct support though, do they? A lot of vector image interchange formats are just plaintext so normal text clipboard APIs should suffice.
Animated images could definitely be somewhat useful though, albeit much more niche than static raster images. In most cases where I want an animated image on my clipboard, a link will suffice. What I want may not map to the majority of course, but at least PNG support is a start!
> A lot of vector image interchange formats are just plaintext so normal text clipboard APIs should suffice.
Yes, but I don't think you can set the MIME type. So whatever you paste in would have to be smart enough to look at a text/plain clipboard data and figure out if it looks like an SVG (or whatever).
According to MDN you can choose one of the following MIME types:
text/plain
text/uri-list
text/csv
text/html
image/svg+xml
application/xml, text/xml
application/json
So at the very least there's image/svg+xml, but that is pretty limiting.