PNG-spec icon indicating copy to clipboard operation
PNG-spec copied to clipboard

Interpolation preference

Open svgeesus opened this issue 4 years ago • 4 comments

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.

svgeesus avatar Jan 21 '21 03:01 svgeesus

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

Crissov avatar May 27 '23 07:05 Crissov

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

ace-dent avatar Nov 05 '23 10:11 ace-dent

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.

ProgramMax avatar Jun 27 '24 13:06 ProgramMax

Related:

  • https://github.com/w3c/csswg-drafts/issues/6252
  • https://github.com/w3c/csswg-drafts/issues/6038
  • https://github.com/w3c/csswg-drafts/issues/5837

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.

svgeesus avatar Jul 03 '24 18:07 svgeesus