w3c / largest-contentful-paint

Specification for the LargestContentfulPaint API
https://w3c.github.io/largest-contentful-paint/
Other
88 stars 16 forks source link

Add entropy calculation #115

Open clelland opened 1 year ago

clelland commented 1 year ago

This adds a simple calculation of image entropy, defined as the number of bytes in the image resource, divided by the rendered size of the image. If an image fails to meet the entropy threshold, then it is excluded as an LCP candidate image.

Closes: #72, #86


Preview | Diff

clelland commented 1 year ago

Open question - should the threshold be left as implementation-defined? This calculation could be effectively skipped by setting it to 0, if an implementor wanted to ignore entropy.

sefeng211 commented 4 months ago

Ian, is there anything prevent this from landing? I think we can start with 0.05 for now to make sure all implementations have the same value. If we want to allow implementations to ignore entropy, maybe we can specify this feature is optional rather than making entropy itself to be implementation-defined.

@clelland

clelland commented 4 months ago

I think that question was the only reason I hadn't landed it yet. I can add a word or two to make the step optional if the implementation doesn't want to consider entropy (if you think that's useful -- or else we can just make it part of the definition)

sefeng211 commented 4 months ago

Maybe just part of the definition I think?

sefeng211 commented 4 months ago

@clelland Ian, do you have data about how often an low entropy image is detected? Or how useful is this? Or any data related to how the threshold was picked? Thanks!