question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

setImageSmoothingEnabled ignored when useSketch is true

See original GitHub issue

I found some situations where image smoothing was being applied at high zoom when viewing multiple images, even though I have set the following optons when initialising the OSD Viewer:

        imageSmoothingEnabled: false,
        smoothTileEdgesMinZoom: Infinity,

I am using opacity to switch rapidly between multiple tileSources, by adapting a Codepen recipe on image fading by @iangilman.

The fault is intermittent, and occurs around 20x - 40x zoom on images around 3000x2000 pixels in size. The first image always has nearest-neighbour (NN) interpolation (image smoothing off), as intended. But sometimes the second image has bi-linear (BL) interpolation (image smoothing on). Occasionally, zooming or panning the second image was causing the interpolation to switch between NN and BL.

I think my use of multiple images and opacity together with certain zoom or pan conditions is triggering the useSketch flag inside drawer.js, which then creates a new context. The new context is missing the image smoothing settings.

I am about to submit a pull request which fixes this issue in my testing.

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:5 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
iangilmancommented, Apr 18, 2019

Thank you for tracking this down! I’ve merged #1647, but let me know if you figure out what’s causing the remaining issue.

0reactions
yellowtailfancommented, Apr 19, 2019

I’ve confirmed using the code before #1647 was applied that the bug described at the top of this issue still occurs when viaWebGL is disabled.

I’ve also found a new reproducible bug, using OSD with #1647 applied and viaWebGL disabled:

  1. Open 2 images with size about 2500x1750
  2. Switch to second image
  3. Zoom in to about 10x
  4. Resize the browser window

After resizing the browser window, the second image has image smoothing applied.

Read more comments on GitHub >

github_iconTop Results From Across the Web

CanvasRenderingContext2D.imageSmoothingEnabled
This property is useful for games and other apps that use pixel art. When enlarging images, the default resizing algorithm will blur the...
Read more >
How to force imageSmoothingEnabled to be false
It looks like FabricJS forces imageSmoothingEnabled to be true during the initial creation of the canvas class--even if you set ...
Read more >
Class: Drawer - OpenSeadragon
setImageSmoothingEnabled(imageSmoothingEnabledopt). Turns image smoothing on or off for this viewer. Note: Ignored in some (especially older) browsers that do ...
Read more >
Canvas​Rendering​Context2D.image​Smoothing​Enabled
On getting the imageSmoothingEnabled property, the last value it was set to is returned. This property is useful for games and other apps...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found