HiDPI screenshots appear too large by default

I’m on a MacBook Pro 16". Here’s a screenshot I just captured of the Discourse logo.

logo

That’s too large; it should be displayed at 50% by default.

logo

It’s possible to detect this by reading the PNG metadata. For example, here’s ImageMagick’s metadata:

$ identify -verbose logo.png | head
Image:
  Filename: logo.png
  Format: PNG (Portable Network Graphics)
  Mime type: image/png
  Class: DirectClass
  Geometry: 312x90+0+0
  Resolution: 144x144
  Print size: 2.16667x0.625
  Units: PixelsPerInch
  Colorspace: sRGB

HiDPI images have a resolution of 144x144.

Discourse should detect this situation, and show the image resized down to 50% by default.

4 Likes

It certainly would be nice if this could be automatically detected. I have my computer zoomed to 125%, so my screenshots are always shown too large by default as well.

Unfortunately it doesn’t apply to all cases, iOS screenshots for example appear to lack Image/Resolution all together. (iOS 13.6)

3 Likes

That depends on how you store the screenshot. If you save the screenshot to Files, it saves as PNG, and keeps its resolution information. If you save the screenshot to Photos and then upload from there, it loses its resolution information. (I think it’s saving the image as HEIF and then transcoding to PNG or something.)

1 Like

Sure, and if our users are anything to go by the latter is the far more common of the two. Screenshots are only saved to files if you interrupting their capture and manually redirect them.

1 Like

I think it would also be possible to use some heuristics to detect iPhone screenshots. (PNGs from an Apple device that are the exact dimensions of an iPhone screen…)

I did consider that, but many of the screenshots I share here are cropped either for privacy, or to focus on a specific element.

I don’t disagree that hidpi is an inconvenience here, usually I just halve the dimensions in the markdown to address it.