Solved In QML how to set Image bytearray in Android?
-
Hi!
In QML how to set Image bytearray in Android?
In Windows normally I send the bytearray to the Image. In Android I get an error: W/lib Web View Browser.so(18315): qrc:/ListView1.qml:131:25: QML Image: Error decoding: data:image/jpg;base64,: Unsupported image format -
@mikeeeeee said in In QML how to set Image bytearray in Android?:
Unsupported image format
Either the data you're sending is not JPEG or you did not deploy the JPEG Qt plug-in together with you app.
-
This works on Windows, so I think the format is fine.
-
@mikeeeeee said in In QML how to set Image bytearray in Android?:
I think the format is fine
No, it's not. Read the error you posted here:
data:image/jpg;base64,: Unsupported image format -
@mikeeeeee
might actually be an endian error, where do you get your Bytearray from? -
It's errors:
W linker : Warning: "/data/data/org.qtproject.example/qt-reserved-files/plugins/imageformats/libqgif.so" has unsupported flags DT_FLAGS_1=0x80 (ignoring unsupported flags)
W linker : Warning: "/data/data/org.qtproject.example/qt-reserved-files/plugins/imageformats/libqicns.so" has unsupported flags DT_FLAGS_1=0x80 (ignoring unsupported flags)
W linker : Warning: "/data/data/org.qtproject.example/qt-reserved-files/plugins/imageformats/libqico.so" has unsupported flags DT_FLAGS_1=0x80 (ignoring unsupported flags)
W linker : Warning: "/data/data/org.qtproject.example/qt-reserved-files/plugins/imageformats/libqjpeg.so" has unsupported flags DT_FLAGS_1=0x80 (ignoring unsupported flags)
W linker : Warning: "/data/data/org.qtproject.example/qt-reserved-files/plugins/imageformats/libqtga.so" has unsupported flags DT_FLAGS_1=0x80 (ignoring unsupported flags)
W linker : Warning: "/data/data/org.qtproject.example/qt-reserved-files/plugins/imageformats/libqtiff.so" has unsupported flags DT_FLAGS_1=0x80 (ignoring unsupported flags)
W linker : Warning: "/data/data/org.qtproject.example/qt-reserved-files/plugins/imageformats/libqwbmp.so" has unsupported flags DT_FLAGS_1=0x80 (ignoring unsupported flags)
W linker : Warning: "/data/data/org.qtproject.example/qt-reserved-files/plugins/imageformats/libqwebp.so" has unsupported flags DT_FLAGS_1=0x80 (ignoring unsupported flags)How to fix this?
-
I do in C++ screen, translate it into QImage and translate in Bytearray
-
@mikeeeeee said in In QML how to set Image bytearray in Android?:
How to fix this?
Do you get this on Android?
For which platform were these libraries build? -
Yes, I need an Android.
-
@mikeeeeee For which platform were these libraries build?
-
For Android.
armeabi-v7a (Clang Qt 5.13.0 for Android ARMv7) -
@mikeeeeee I do this on my Android application, and it works fine (Android 7.1/7.0 and Qt 5.7). Do you have enabled multimedia support in you PRO file with
QT += multimedia
? -
@kromignon said in In QML how to set Image bytearray in Android?:
multimedia
Yes.
If i do dhis, I get screenShot: "data:image/png;base64,"
The program does not take a screenshot.QImage myScreen; //QPixmap pic = QPixmap::grabWindow(QWidget::winId(),0,0,50,50); //qDebug()<<QWidget::winId(); QScreen *screen = QGuiApplication::primaryScreen(); QPixmap pixamp; pixamp = screen->grabWindow(0); myScreen = pixamp.toImage(); //myScreen = quickView->grabWindow(); //myScreen.save("C:\\Users\\New Owner\\Downloads\\i.png"); QByteArray bArray; QBuffer buffer(&bArray); buffer.open(QIODevice::WriteOnly); //myScreen.save(&buffer, "JPEG"); //QString image("data:image/jpg;base64,"); myScreen.save(&buffer, "PNG"); QString image("data:image/png;base64,"); image.append(QString::fromLatin1(bArray.toBase64().data())); qDebug()<<"screenShot:"<<image; return image;
-
@mikeeeeee So your real problem is not showing PNG but taking a screenshot? right?
-
@kromignon said in In QML how to set Image bytearray in Android?:
o your real problem is not showing PNG but taking a screenshot? right?
Yes