Media to byte array
-
I'd like to create an image and sound cache for an application. The image and sound files are retrieved remotely via url. (http://myDomain.com/someCoolImage.png) I want to save the images locally and retrieve them from there, rather than re-download them every session. There are a few suggestions out there about how to convert a byteArray to an image, but not much about converting an Image to any sort of savable format. Anyone know of a good way to do this? Extra appreciation if it can be done in pure qml.
-
I'd like to create an image and sound cache for an application. The image and sound files are retrieved remotely via url. (http://myDomain.com/someCoolImage.png) I want to save the images locally and retrieve them from there, rather than re-download them every session. There are a few suggestions out there about how to convert a byteArray to an image, but not much about converting an Image to any sort of savable format. Anyone know of a good way to do this? Extra appreciation if it can be done in pure qml.
@JeTSpice said in Media to byte array:
not much about converting an Image to any sort of savable format
Well just save it to the image's format, like PNG or JPEG.
-
@JeTSpice said in Media to byte array:
not much about converting an Image to any sort of savable format
Well just save it to the image's format, like PNG or JPEG.
-
Oh, you're talking about QML's Image element? I thought you're downloading the files in C++.
OK, so here I have 2 hints:
- use the Image's URL to download the actual file using QNetworkAccessManager in C++ - then saving is easy
- use an image provider to download / store / retrieve the images in any way you want or need. It will take some time to code it in, but it's potentially a very robust solution
-
Oh, you're talking about QML's Image element? I thought you're downloading the files in C++.
OK, so here I have 2 hints:
- use the Image's URL to download the actual file using QNetworkAccessManager in C++ - then saving is easy
- use an image provider to download / store / retrieve the images in any way you want or need. It will take some time to code it in, but it's potentially a very robust solution