Skip to content

Fix image blur not applying on mobile browsers - #10

Merged
diceroll123 merged 4 commits into
mainfrom
worktree-fix-mobile-blur
Sep 11, 2026
Merged

diceroll123 merged 4 commits into
mainfrom
worktree-fix-mobile-blur

Conversation

@diceroll123

Copy link
Copy Markdown
Contributor

Summary

  • Canvas ctx.filter = "blur(...)" is silently ignored by iOS Safari (and unreliable on other WebKit builds), so the uploaded photo's Blur slider had no visible effect on mobile.
  • Replaces it with a dependency-free downsample-then-upsample blur that uses only drawImage/imageSmoothingEnabled, which is reliable on every browser.
  • Also fixes the PNG export path, since it reuses the same rendering code. SVG export was already correct (uses a real <feGaussianBlur>) and is untouched.

Canvas ctx.filter blur() is silently ignored by iOS Safari (and
unreliable on other WebKit builds), so the uploaded photo's blur
slider had no visible effect on mobile. Replace it with a
downsample-then-upsample technique using only drawImage, which
works reliably everywhere.
@github-actions

github-actions Bot commented Sep 5, 2026 •

Copy link
Copy Markdown
PR Preview Action v1.8.1
Preview removed because the pull request was closed.
2026-09-11 20:32 UTC

The downsample-then-upsample approximation looked mushy/blocky
compared to the original ctx.filter blur. Replace it with a
triple-pass box blur on pixel data (the standard cheap Gaussian
approximation), which gives a much closer match to how blur looked
on desktop, while still avoiding ctx.filter for mobile reliability.
Working resolution is capped so cost stays bounded even at large
export sizes.
Swap the custom triple-pass box blur for stackblur-canvas, a small,
well-tested library that implements the same near-Gaussian blur
technique with correct alpha handling, removing ~90 lines of
fiddly custom pixel-manipulation code.
It was only used once, right after being computed.
@diceroll123
diceroll123 merged commit 1420a00 into main Sep 11, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant