When you attach images to a post, Discourse resizes them to make thumbnails suitable for display.
There seems to be a bug when it does this which causes it to consistently lose the top and bottom rows of pixels.
This isn’t a huge deal but makes things with thin borders look weird. (e.g. Most Windows 10 software screenshots look wrong because the bottom edge of the window isn’t there.)
Observations:
-
It doesn’t seem due to aspect ratio, so I don’t think it’s the intentional cropping of very wide/tall images; it seems like a bug.
-
I’ve checked that pixels are missing in the actual thumbnail image resource. So it’s happening when the thumbnail is generated on the backend, not when it’s displayed by the browser.
-
Edit: I’ve just noticed that the top/bottom pixels are not gone completely, but they are so blended/faded that they may as well be. Maybe something to do with how the edges of the image are handled by the resize algorithm? It doesn’t ever seem to happen to the left and right edges, e.g. with portrait aspect screenshots.
-
When you click for the full-size image, that is displayed correctly, at least.
Hopefully this example image will reproduce the problem here on the Discourse forum:
That should be a white image with a 1 pixel red border on all sides. If the problem happens here, you’ll only see the left and right borders until you click for the full-size image.
(Edit: It does indeed seem to happen here.)
In case it doesn’t happen, this is the result I see on my own forum:
When testing this, you have to wait a little while after posting (and sometimes refresh the thread) for it to happen, since it takes a few seconds after posting for the thumbnail to be generated server-side.