-
-
Notifications
You must be signed in to change notification settings - Fork 7.5k
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
[Doc]: Suggestion to use PIL.image.open is not a 1:1 replacement for imread #21474
Comments
|
Ah, I didn’t even know that |
@Debilski Can you open a PR with a note about this? I very much agree with @jklymak that you should not use I think we should either drop the code snippet and instead link to |
I’ve added |
Closed by #21484 |
Hello, |
Documentation Link
https://matplotlib.org/stable/api/_as_gen/matplotlib.pyplot.imread.html
Problem
Following the deprecation message in
matplotlib.pyplot.imread
(when used with a URL) and trying to replace the code as suggested withPIL.Image.open(urllib.request.urlopen(url))
, the resulting object is a PIL image object and not a numpy array as it used to be. As we are typically suggestingimread
to create a numpy array from an image file (or URL) in some of our teaching materials, this is a bit confusing.This is probably not a problem for matplotlib itself, as it can perfectly deal with the PIL object in eg.
imshow
, therefore I don’t know if it needs to be changed (it could be out of scope for the matplotlib documentation to clarify this).Suggested improvement
Additionally present code that shows how to transform the PIL image object into an array.
Matplotlib Version
3.4.3
Matplotlib documentation version
3.4.3
The text was updated successfully, but these errors were encountered: