-
Notifications
You must be signed in to change notification settings - Fork 11
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
Disable browser interpolation of <canvas> #10
Comments
Thanks for the heads up. I am not sure this is applicable here though. This code is drawing pixels using Are you suggesting this based on observation, or just as a general precaution? |
I am on a retina MBP and I can notice the difference. See: These are 1:1 screenshots from my display (sorry that they are not the same size) I would say that the pixelated version is much closer to the intent than the blurry one. |
Cool, thanks! I have pushed the changes to the CSS. Can you please refresh the demo page and confirm if it is fixed? I don't notice any difference in my display.
Nope. |
For my eye this looks better but not quite 100% right after playing with it a bit. Maybe something like this could work:
The resulting image should receive the same post processing a normal image is. |
How did you compare? Did you try decoding to PNG using the native Your idea of drawing via browser native graphics is nice though. I would do it slightly differently:
|
@FWeinb Are your screenshots for a truncated FLIF or for the full FLIF? And what are you comparing against (original image / same-sized PNG / same-size JPG)? |
Here's a comparison (2_webp_ll) with "0% truncation" vs. "original image" on a MacBook Pro retina (1:2 pixel ratio). I manually upscaled the screenshot with nearest neighbor to make the different more pronounced (and to avoid the effect being reapplied twice since I took the screenshot on a retina screen). |
On Wed, Oct 21, 2015 at 9:19 PM, Blixt notifications@github.com wrote:
Can you upload it without upscaling? It is quite confusing. Thanks! |
Here is a longish article explaining the problem and a (partial?) solution. I can't fix this myself because I don't have such an exotic display. PRs welcome. In my opinion, the best approach might be to create a blob image and use I also hope to design the API such that the decoding of the FLIF and its rendering are two separate functions; allowing independent improvements to them in the future. |
For future reference, I found another article. |
You don't need to do any of those things, those articles are outdated to work around image rendering. So the thing happening is that your canvas is pixelated (not upsampled), while the PNG is upsampled (not pixelated). All you need to do is to make the PNG pixelated as well (using |
That seems fair for the purpose of comparison. I will do that soon. |
I have pushed an update with "pixelation" enabled on the right side comparison view, so that the comparison with FLIF is fair on high-resolution displays. Please let me know if it doesn't work. I still need to figure out how to handle this as a library (for standalone viewing of FLIFs). |
I tested the current demo with a virtual screen having 192 DPI, with Chromium. The current CSS rules are working fine for the demo. Both the left side canvas (containing decoded FLIF pixels) and the right side image (containing decoded PNG or JPEG pixels) appear similarly pixelated on a higher DPI screen. As for the library, dealing with arbitrary images, either the image or the API would need to specify the original resolution of the image. Then the library could scale the canvas (or underlying image buffer) accordingly, to match the screen resolution. |
Currently the browser is doing some interpolation to the canvas that will affect the quality of the decoded image and will affect the perception of the flif image format. To disable this across browsers you would need to add:
via StackOverflow
The text was updated successfully, but these errors were encountered: