Skip to content

Disable Image Smoothing for ImageSource#364

Merged
martinRenou merged 1 commit intogeojupyter:mainfrom
Meriem-BenIsmail:image-smoothing
Jan 20, 2025
Merged

Disable Image Smoothing for ImageSource#364
martinRenou merged 1 commit intogeojupyter:mainfrom
Meriem-BenIsmail:image-smoothing

Conversation

@Meriem-BenIsmail
Copy link
Member

@Meriem-BenIsmail Meriem-BenIsmail commented Jan 20, 2025

Description

Fixes #353.

Before
image

After
image

Checklist

  • PR has a descriptive title and content.
  • PR description contains references to any issues the PR resolves, e.g. Resolves #XXX.
  • PR has one of the labels: documentation, bug, enhancement, feature, maintenance
  • Checks are passing.
    Failing lint checks can be resolved with:
    • pre-commit run --all-files
    • jlpm run lint

📚 Documentation preview: https://jupytergis--364.org.readthedocs.build/en/364/
💡 JupyterLite preview: https://jupytergis--364.org.readthedocs.build/en/364/lite

@Meriem-BenIsmail Meriem-BenIsmail added the bug Something isn't working label Jan 20, 2025
@github-actions
Copy link
Contributor

Binder 👈 Launch a Binder on branch Meriem-BenIsmail/jupytergis/image-smoothing

@github-actions
Copy link
Contributor

Integration tests report: appsharing.space

layer.on('prerender', event => {
const context = event.context;
if (context && context.canvas) {
const canvasContext = context.canvas.getContext('2d');
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👀 so there is no official OpenLayers API to disable image smoothing? Do we really need to get our hands dirty and manipulate the canvas context?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Based on what I read, there was a way before with OpenLayers to set the imageSmoothing: false but I guess it's not available anymore with the current version. If someone has another way to do it, I'm open for suggestions!

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's unfortunate :S

Let's get this PR in, we can always revisit it later if we have a better solution for this.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Setting interpolate: false when adding Image Layers here should accomplish the same thing.

interpolatefalse

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah great! Thanks for looking into it

Copy link
Member

@martinRenou martinRenou left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@martinRenou martinRenou merged commit fa1cc9e into geojupyter:main Jan 20, 2025
17 of 18 checks passed
@mfisher87
Copy link
Member

It's beautifully blocky 🤩

HaudinFlorence pushed a commit to HaudinFlorence/jupytergis that referenced this pull request Jan 28, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Disable smoothing for ImageLayers

4 participants