Menu

1 / 4

Why Does Canvas Look Blurry on Retina Displays? devicePixelRatio and the Tale of Two Sizes

JavaScript in Plain English - Medium·Mustafa Morbel·4 days ago
#IXVqTSIR
Reading 0:00
15s threshold

Member-only story

JavaScriptHtml5CanvasWeb PerformanceWebgl Why Does Canvas Look Blurry on Retina Displays? devicePixelRatio and the Tale of Two Sizes

Mustafa Morbel

24 min read6 hours ago

CSS pixels and device pixels are not the same thing. We separate intrinsic resolution from display size to build a razor-sharp canvas — and then honestly measure the dpr² performance cost.

Last week, I opened the exact same Canvas code on two different monitors. On my external display, the lines looked razor-sharp. When I dragged the window over to my laptop’s built-in Retina display, those same lines went soft — as if I were looking at them through fog. Not a single line of code had changed. The only variable was the screen.

Press enter or click to view image in full size Blurry Canvas

My first instinct was to blame font rendering or overly aggressive anti-aliasing.…

Continue reading — create a free account

Join HashtagPLUS to read full articles, follow hashtags, vote, and join the conversation.