QML Image: Error decoding: Unable to read image data
-
Hi all,
I am using qt.4.8 with QtQuick 1.1.
In my application i am having two diffrent .qml file(entry_INO.qml and exit_INO.qml), from each file i am calling cpp utility to capture image and display them., same code same functionality butbut getting below error only from entry_INO.qml whereas everything works fine with exit_INO.qml
entry_INO.qml :: loading preview image3 Not a JPEG file: starts with 0xff 0xd9 qrc:/source/entry_INO.qml:4186:17: QML Image: Error decoding: file:///home/user/ipcamera/previewImage/camera1.jpg: Unable to read image data
-
Hi
Sounds almost impossible.also same file ?
It seems like it dont like file.¨ -
hi @mrjj aahhhh... yes same cpp function i am calling.. same code line in both .qml files.. now i need to figure out why it dont like file :)..
-
Well first start is to click on image and see if it can be open at all.
maybe its just raw or incomplete. :) -
@mrjj its perfectly fine data, i can see it well by clicking directly.
i am wondering same code working fine week ago, i havent touch the code block meantime and got this error. other qml file work well issue with this one only. -
@Anas_Deshmukh
Its Monday syndrome on a Friday.
If you try other image at other location.
Still same error? -
@Anas_Deshmukh
It may not be a jpg file but has extension as jpg. Please try with another file. -
@Tirupathi-Korla image genrated after cpp function call, if image had wrong data then it must affect other .qml files.
-
Please provide a download link for the jpg file.
-
@Anas_Deshmukh
show the cpp method implementation please.
Also how is this method called exactly (regarding thread safety)? -
@Anas_Deshmukh
Try figuring out the image format you are using. Try using any png file.. -
int ipCamera::capturePreviewImage1() { int ret; fileClass fileClass1; bool flag=fileClass1.fileExists("/home/user/ipcamera/previewImage/camera1.jpg"); if(flag) QFile::remove("/home/user/ipcamera/previewImage/camera1.jpg"); QString cameraIp="192.168.1.113"; QString command="wget -O /home/user/ipcamera/previewImage/camera1.jpg http://"+ cameraIp+"/snapshot.jpg?user=admin&pwd="; ret=system(qPrintable(command)); if(ret<0) { qDebug() << "system call for capturePreviewImage1 failed"; return ret; } QString permission="chmod -R 777 /home/user/ipcamera/previewImage/"; qDebug() << "change permission command : previewImage : " << permission; qDebug() << "previewImage1 end "; return 1; }```
-
@Wieland its ip camera . command i am using is :
wget -O /home/user/ipcamera/previewImage/camera1.jpg http://192.168.1.113/snapshot.jpg?user=admin&pwd=
-
@Anas_Deshmukh
File format in the header of image file might be different.
Open file with binary editor in Qt Creator. You should see actual file format of the image. Change format of your image to that format and you should not see any error.Usually jpeg file starts with 0xFF 0xD8 and ends with 0xFF 0xD9, which in your case showing as starting of your file.
And one more thing.. If image has wrong data, it wont effect other .qml file.
-
@Tirupathi-Korla thanks for note abt qt binary editor its good to learn, but in every scenario my file starts with 0xFF 0xD8 and ends with 0xFF 0xD9 (default jpeg).
If i open same file in other qml it open correctly, it seems with that perticular .qml file lead me err.
still trying to fix it... -
@Tirupathi-Korla file command output, i am sure image capture is not corrupted, still wondering why it not open in qml with err
Not a JPEG file: starts with 0xff 0xd9 qrc:/source/entry_INO.qml:4202:17: QML Image: Error decoding: file:///home/user/ipcamera/previewImage/camera1.jpeg: Unable to read image data
file command ouput :
file /home/user/ipcamera/previewImage/camera1.jpeg /home/user/ipcamera/previewImage/camera1.jpeg: JPEG image data, JFIF standard 1.01, baseline, precision 0, 4360x240
-
Hi everyone,
I put tiny delay between capture event and loading event.
in my code i figure out that i am loading before it get saved completely.nothing wrong with code, lesson learnt Never be so fast to access something before it finish first task.
thanks everyone :)