B
B
boggydoggy2021-10-31 17:40:56
PyQt
boggydoggy, 2021-10-31 17:40:56

Pyqt5. Why can't display png, jpg, gif images?

It became impossible to work with images, I get empty forms. When I type in cmd python -c "from pathlib import Path;from PyQt5.QtCore import QLibraryInfo;image_plugin_path = Path(QLibraryInfo.location(QLibraryInfo.PluginsPath)) / 'imageformats';print(image_plugin_path) I get a path where instead of the name user folder (which is written in Cyrillic) outputs "Åâà", also QImageReader.supportedImageFormats()gives me [PyQt5.QtCore.QByteArray(b'bmp'), PyQt5.QtCore.QByteArray(b'pbm'), PyQt5.QtCore.QByteArray(b'pgm'), PyQt5.QtCore.QByteArray(b'png') , PyQt5.QtCore.QByteArray(b'ppm'), PyQt5.QtCore.QByteArray(b'xbm'), PyQt5.QtCore.QByteArray(b'xpm')], that is, the necessary gif and jpg are not here, but png, despite being present, it is also not displayed. At the same time, Qt5\plugins\imageformats has everything you need.

617ea996d5383676768181.png

Answer the question

In order to leave comments, you need to log in

1 answer(s)
B
boggydoggy, 2021-10-31
@boggydoggy

Problem solved. All I had to do was copy the "imageformats" folder into the "python.exe" folder.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question