I can't load/save jpg
image in Qt. I checked the imageformat
folder in plugins folder and I found the dll/lib
files related to this extension.
Here's the code I'm using:
void loadImages(){
QImage image;
QString folderName = "C:\\img-src\\";
bool isLoaded;
for(int i=1;i<3;i++){
QString fileName = folderName + QString::number(i) + ".jpg";
isLoaded = image.load(fileName,"JPG");
if(isLoaded){
qDebug() << "loaded";
}else{
qDebug() << "not loaded";
}
//Rest of the code
}
}
I found what the problem was.
I have to copy the imageformats
folder next to the exe file of the program to enable loading/saving jpg files.