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

Get all visible pixels as array or data url #140

Open
divyaaaaaa opened this issue Jan 3, 2024 · 0 comments
Open

Get all visible pixels as array or data url #140

divyaaaaaa opened this issue Jan 3, 2024 · 0 comments

Comments

@divyaaaaaa
Copy link

Is your feature request related to a problem? Please describe.
I want to be able to get the screen grab of visible pixels in the layer and pass it for let's say Machine Learning Inference. It would be nice if there a was direct toDataUrl giving all the visible pixels.

Currently, it looks very difficult to obtain, slice and stitch values from getActiveTiles.

Describe the solution you'd like
A toDataUrl or getPixelArray kind of function to give me the values. I'm relatively new to JS, but seems if pixels are visible on Canvas, they might as well be extracted.

Describe alternatives you've considered
Solution I am trying currently is to use getActiveTiles, slice to canvas extent and concatenate all the tiles.
An alternative is to use getValues, but that too would need some stitching.
Another alternative, not very relevant here, is I'm planning to use rasterio based python service in the backend, which would bring unacceptable latency.

Additional context

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

No branches or pull requests

1 participant