Details
-
Bug
-
Resolution: Duplicate
-
Not Evaluated
-
None
-
5.5.0
-
None
Description
the jpeg image format plugin can not read jpg file without exif info or without exif orientation info. refer to the attachment.
The problem is:
1, in bool QJpegHandlerPrivate::read(QImage *image)
Only if "State==ReadHeader', then it will read the jpeg contents.
But
2, in bool QJpegHandlerPrivate::readJpegHeader(QIODevice *device)
if (exifOrientation == -1)
return false;
At that time, even if the file is a valid jpg, if it does not contain any exif infos or does not contain exifOrientation infos, it will retrun directly and leave "state" not set to "ReadHeader".
Here is a patch to fix it:
diff -Nur qtbase-opensource-src-5.5.0/src/gui/image/qjpeghandler.cpp qtbase-opensource-src-5.5.0n/src/gui/image/qjpeghandler.cpp
— qtbase-opensource-src-5.5.0/src/gui/image/qjpeghandler.cpp 2015-06-29 20:04:51.000000000 +0000
+++ qtbase-opensource-src-5.5.0n/src/gui/image/qjpeghandler.cpp 2015-08-13 20:41:32.187145848 +0000
@@ -900,7 +900,8 @@
size = QSize(width, height);
format = QImage::Format_Invalid;
- read_jpeg_format(format, &info);
+ if(read_jpeg_format(format, &info))
+ state = ReadHeader;
QByteArray exifData;
@@ -935,7 +936,6 @@
transformation = exif2Qt(exifOrientation);
}
- state = ReadHeader;
return true;
}
else
if "file is a valid jpg file" and be supported, then set "state" to "ReadHeader".
And the jpeghandler codes still need more improvements, for example:
"readJpegHeader" had a "bool' retrun value but the value is never used.
Actually, the existence and use of "ReadHeader" state is awkward and almost useless.
Attachments
Issue Links
- duplicates
-
QTBUG-46870 [REG 5.4.2 -> 5.5.0] JPEG-compressed images cannot be rendered correctly.
- Closed