[SOLVED]Read Image from Android Storage in Qml
I need to read an image from(ex: "/storage/sdcard0/DCIM/IMG_001.jpg") internal storage of android mobile to qml image source..I tried various ways..I could not do this.Please help me with ur ideas
source: "/storage/sdcard0/DCIM/IMG_001.jpg" //doesnt work
You should prepend file:// to the path.
thanks...it works fine..
here is code..
Thank u so much :-)
I'm trying to do exactly the same. However I get a totally black image back instead of my original image.
Would you tell me if you had any similar problems, and if so, how you solved them?
that should work absolutely fine...
if not can u post ur code here...?
Thank you for your help.
-I'm trying to set the source of the Image Element like that: @"file:///storage/emulated/0/Download/image.png"@ and the result is an absolutely black image.
I have also tried using QQuickImageProvider rendering the image like that @ QPixmap pixmap("/storage/emulated/0/Download/image.png");@ but the same problem occurs.
To my mainfest.xml I have this line added: <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/>
Oh, it seems like I figured it out. It works absolutely fine, but unfortunatelly not with the Download folder. I don't know what the problem is, there might be some extra permission reuired to acces the Download folder on Android. Or I don't know. -
This solution is perfect. My problem was originated from trying to use images with a too large resolution. If I set the sourceSize property, it scales down my image to the desired resolution, and it works perfectly. Thank you!