Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. QML and Qt Quick
  4. Media to byte array
Qt 6.11 is out! See what's new in the release blog

Media to byte array

Scheduled Pinned Locked Moved Solved QML and Qt Quick
6 Posts 3 Posters 2.1k Views 2 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • J Offline
    J Offline
    JeTSpice
    wrote on last edited by
    #1

    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.

    sierdzioS 1 Reply Last reply
    0
    • J JeTSpice

      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.

      sierdzioS Offline
      sierdzioS Offline
      sierdzio
      Moderators
      wrote on last edited by
      #2

      @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.

      (Z(:^

      J 1 Reply Last reply
      1
      • SGaistS Offline
        SGaistS Offline
        SGaist
        Lifetime Qt Champion
        wrote on last edited by
        #3

        Hi,

        On the non QML side, QCache might be of interest.

        Interested in AI ? www.idiap.ch
        Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

        1 Reply Last reply
        2
        • sierdzioS sierdzio

          @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.

          J Offline
          J Offline
          JeTSpice
          wrote on last edited by
          #4

          @sierdzio But there is no Image.bitmap, Image.byteArray, Image.data, Image.content or similar. No access to the image's data in order to save it.

          1 Reply Last reply
          0
          • sierdzioS Offline
            sierdzioS Offline
            sierdzio
            Moderators
            wrote on last edited by
            #5

            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

            (Z(:^

            J 1 Reply Last reply
            2
            • sierdzioS sierdzio

              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
              J Offline
              J Offline
              JeTSpice
              wrote on last edited by
              #6

              @sierdzio thank you.

              1 Reply Last reply
              0

              • Login

              • Login or register to search.
              • First post
                Last post
              0
              • Categories
              • Recent
              • Tags
              • Popular
              • Users
              • Groups
              • Search
              • Get Qt Extensions
              • Unsolved