w3c / png

Maintenance of the PNG specification
https://w3c.github.io/png/
Other
44 stars 11 forks source link

Interpolation preference #21

Open svgeesus opened 3 years ago

svgeesus commented 3 years ago

Raised by: Jayden Irwin Originally raised: 28 Sep 2020

I would like to suggest a new flag be added to the PNG spec. This Boolean can represent whether the image prefers-interpolation. For 95% of images, this flag will be true, but for any images that are pixel-art, this flag will be false, implying nearest-neighbour scaling should be used to keep the image sharp.

This flag would help file viewers or webpages render the image in a way that matches the content of the image. Currently systems have no way of telling if images are pixel-art, and usually apply interpolation for all image scaling. This flag would also solve issues like sharing pixel-art on the web. For example if I want to share my pixel art on a website like Twitter, I must upload an image maybe about 10 times it’s normal size to minimize the effects of interpolation, so users can view the image as it is meant to be viewed. This is a waste of storage, and still results in interpolation being used.

Crissov commented 1 year ago

Also see discussion in https://github.com/WICG/proposals/issues/98

ace-dent commented 10 months ago

+1 for a solution with reasonable compatibility across image formats- and eventual browser support. 🤞🏻

ProgramMax commented 2 months ago

The original suggestion mentioned a bool. This would be better served as a list of enumumerated scaling algorithms, in order of preference. Or as a single preferred behavior as mentioned in the proposal linked above.

svgeesus commented 2 months ago

Related:

If this does get added to the PNG spec, we should also describe the interaction and conflict handling when the image and the embedding context (HTML/CSS/SVG) call for different values.