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

Support image data as a numpy array #4

Closed
markspec opened this issue Apr 17, 2023 · 3 comments · Fixed by #6
Closed

Support image data as a numpy array #4

markspec opened this issue Apr 17, 2023 · 3 comments · Fixed by #6

Comments

@markspec
Copy link

I have a use case where my data is in memory in a numpy array. It would be great to be able to support this use case.

@alexlib
Copy link

alexlib commented May 8, 2023

My workaround is to save the NumPy array as a temporary image and use that. A bit ugly, but it works. But I support the request to the author to suggest a better way to handle this case

@blackary
Copy link
Owner

I'm not sure what exactly you mean by "a temporary image" but converting it to a PIL image and then passing that in should work well. I think I would prefer that over trying to support any numpy array, since it might not always be straightforward to support this generically (e.g. if the array needs reshaped from N to X*Y before it can be read as an image).

https://stackoverflow.com/questions/10965417/how-to-convert-a-numpy-array-to-pil-image-applying-matplotlib-colormap

If you have a case where this doesn't work well, please let me know.

@alexlib
Copy link

alexlib commented Jun 13, 2023

i could only write the image file from PIL buffer and read it again in another page

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

Successfully merging a pull request may close this issue.

3 participants