Loading PIL Image to QPixMap #8314
-
I have a need to get PSD photos into a QLabel from PyQt5. PIL.ImageQt would appear to be the tool. I keep getting errors like 'module' object is not callable. relevant code from PIL import Image, ImageQt
im = Image.Open(filename)
imagetemp = ImageQt(im) ---- This is the line the errors
pixmap = QPixmap.fromImage(imagetemp) I have found lots of examples in StackOverflow and others on Google and this seems to be the way. I have tried variations, such as imagetemp = ImageQt.ImageQt(im) or imagetemp = PIL.ImageQt.ImageQt(im) PyCharm code completion suggests all of these should work. Can find nothing on why errors that ImageQt is not callable. Have tried reinstalling PyQt5 and Pillow, no joy. Using PyCharm as my IDE. Any Suggestions. |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 1 reply
-
I don't know why you're not getting an error, but |
Beta Was this translation helpful? Give feedback.
-
I imagine that you're using the latest Pillow version, which at the moment is 10.4.0. PyQt5 support was removed in Pillow 10.0.0. See https://pillow.readthedocs.io/en/stable/deprecations.html#pyqt5-and-pyside2. I suggest you switch to PyQt6. |
Beta Was this translation helpful? Give feedback.
I imagine that you're using the latest Pillow version, which at the moment is 10.4.0.
PyQt5 support was removed in Pillow 10.0.0. See https://pillow.readthedocs.io/en/stable/deprecations.html#pyqt5-and-pyside2.
I suggest you switch to PyQt6.