Skip to content

Make it possible to generate two sets of images widths, for low and high screen densities #64

Description

@nhoizey

Screen with >2dppx density require lower quality, more compressed, images:
https://observablehq.com/@eeeps/visual-acuity-and-device-pixel-ratio

It might be better having different images widths for high density screens (most being mobiles) and low density screens.

Serving lower quality images to high density screens requires using <picture> with a density media query:

<picture>
  <source
    media="(min-resolution: 2dppx), (-webkit-min-device-pixel-ratio: 2)"
    sizes="…"
    srcset="
      image-q10-720.jpg 720w,
      image-q10-1280.jpg 1280w,
      image-q10-1400.jpg 1400w">
  <img
    src="image-q80-320.jpg"
    sizes="…"
    srcset="
      image-q80-360.jpg 360w,
      image-q80-800.jpg 800w,
      image-q80-1024.jpg 1024w">
</picture>

The 2dppx threshold should be a parameter.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions