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
Get a pixel perfect match WMS image #14719
Conversation
📦 Preview the website for this branch here: https://deploy-preview-14719--ol-site.netlify.app/. |
@mike-000 are you allowed to review this pull request? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @sbrunner! I think I understand the change but maybe having a rendering test specifically for this would be good? The unit test does not provide much explicit guarantee of having a crisp final render.
To avoid having little blurry image
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does this result look worse before this change?
I'm not sure I would call this as a "pixel perfect match" compared to the input tile:
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Using a data url might be better test. Currently with a ratio which is an odd fraction of the frame size you get blurring - in https://codesandbox.io/s/simple-forked-qivyjj?file=/main.js red and green pixels are interpolated as #808000 or #7f7f00 but if the ratio is changed to an even fraction e.g. 384 / 256 it is a bright mosaic of the two colors. With the fix that should be seen with any ratio.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure what to make of that sandbox example.
I was anticipating that this fix would make it so a previously blurry map was now less blurry. The code change looks to me like it could accomplish that. I assume it would be possible to demonstrate this with a test. I don't understand why a data url would be required for this.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this change meant to fix a real-world example that can be represented in a test?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Based on the example in #14718
Current blurry
https://codesandbox.io/s/wms-image-custom-proj-forked-2uon5w?file=/main.js
With the fix applied as patch
https://codesandbox.io/s/wms-image-custom-proj-forked-2tl14y?file=/main.js
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've changed the rendering test for the original example in #14718
The image still looks blurry here on GitHub but it's not the case, see:
https://raw.githubusercontent.com/sbrunner/openlayers/blury/test/rendering/cases/source-imagewms-blurry/expected.png
5acd4de
to
cd94884
Compare
Hello, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I agree it looks good. Thanks all for the improvement. |
Thanks :-) |
To avoid having little blurry image
Fix #14718
Thanks @mike-000