-
Hey
I noticed that quite a few people have issues with that. I haven't found any solution, but this does not work >
auto browse = QFileDialog(this); browse.setFileMode(QFileDialog::ExistingFile); browse.setViewMode(QFileDialog::Detail); auto opt = browse.exec(); if (opt) { auto filePath = browse.selectedFiles()[0]; auto fileInfo = QFileInfo(filePath); auto image = QImage(); image.load(filePath,fileInfo.suffix().toStdString().c_str()); if(!image.isNull()){ if(image.width()>512 || image.height()>512){ image = image.scaled(512,512,Qt::KeepAspectRatio); } mUserImage=image; auto small = image.scaled(200,200,Qt::KeepAspectRatio); ui->mUser_userImage->setPixmap(QPixmap::fromImage(small)); } }
Image :
JPG does not load, however PNG does.Win10x64
Qt 6.2.1
CmakeHas any1 found a fix for this? I saw posts on https://bugreports.qt.io/browse/QTBUG-47476 and also one more with EXIF data that are now "fixed" but still fail. PNG appear to work just fine.
-
As I said - make sure the Qt jpeg plugin is there and gets loaded.
-
@Dariusz said in Qt 6 fails to load jpg in to QImage:
JPG does not load, however PNG does.
How did you install Qt? Does it also not work on your development machine? Make sure the Qt jpeg plugin is available and loaded.
-
@Christian-Ehrlicher Using Qt setup app. I did not build anything custom. Used installer from website & run it all. However I did make CMAKE project myself, do I need to include anything special there?
More or less cmake config :
set(QT_VERSION 6) set(REQUIRED_LIBS Core Widgets Gui Network OpenGL Concurrent OpenGLWidgets) set(REQUIRED_LIBS_QUALIFIED_QT Qt6::Core Qt6::Widgets Qt6::Gui Qt6::Network Qt6::OpenGL Qt6::Concurrent Qt6::OpenGLWidgets) find_package(Qt${QT_VERSION} COMPONENTS ${REQUIRED_LIBS} REQUIRED) ADD_DEFINITIONS(-DQT_NO_KEYWORDS) ADD_DEFINITIONS(${QT_DEFINITIONS} -DQT_MESSAGELOGCONTEXT) ADD_DEFINITIONS(-D_USE_MATH_DEFINES)
-
As I said - make sure the Qt jpeg plugin is there and gets loaded.
-
@Christian-Ehrlicher said in Qt 6 fails to load jpg in to QImage:
As I said - make sure the Qt jpeg plugin is there and gets loaded.
Do you know whats the name of plugin or dll? I did a run with the environment variable but all I got is widows dll print and some qfactory stuff. Nothing on jpg/missing plugins.
Where can I find the plugi nI need?Wops I copied all plugins dir from QT to my project & stuff started to work, thank you!
-
@Dariusz said in Qt 6 fails to load jpg in to QImage:
Do you know whats the name of plugin or dll?
imageformats\qjpeg.dll