Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Static image is blurry on high device pixel ratio screens. #158

Open
KyleSmith0905 opened this issue Mar 26, 2024 · 1 comment · May be fixed by #159
Open

Static image is blurry on high device pixel ratio screens. #158

KyleSmith0905 opened this issue Mar 26, 2024 · 1 comment · May be fixed by #159

Comments

@KyleSmith0905
Copy link

On my computer the device pixel ratio is 1.25. I have a like button that animates on click. The stationary image is a bit blurry as it's trying to render a downscaled 24x24 image in a 32x32 grid of pixels.

This may be a helpful resource: https://developer.mozilla.org/en-US/docs/Web/API/Window/devicePixelRatio#correcting_resolution_in_a_canvas

I'm currently working on a fix for it.

@davelavoie
Copy link

Thanks! I was exactly looking for a solution like this!

For those who include the compiled JavaScript file, you can also do the following:

In freezeframe.min.js, search for clientWidth in the minified file, and replace it with naturalWidth. Then, look for clientHeight, and replace it with naturalHeight. Voilà!

Obviously you'll need to host your own version of the file afterwards, since I'm not sure the library is going to be updated in the near future. But at least, it works!

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 a pull request may close this issue.

2 participants