Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Extract embedded resources
Forum Updated to NodeBB v4.3 + New Features

Extract embedded resources

Scheduled Pinned Locked Moved General and Desktop
10 Posts 4 Posters 8.1k Views 1 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.
  • Q Offline
    Q Offline
    qtik5
    wrote on last edited by
    #1

    Hi I'm new to Qt and have been trying it out with simple apps. I compiled some jpegs in to an EXE file, which I now need to extract as the original images are lost due to a hard disk crash. Is there a Qt utility which would help me do that?
    Many thanks.

    1 Reply Last reply
    0
    • A Offline
      A Offline
      andre
      wrote on last edited by
      #2

      Good question. Gammaray (by KDAB) is able to display the resources, but I did not see an option to extract them. Still, that should be an easy enough addition, and the tool is open source.

      1 Reply Last reply
      0
      • A Offline
        A Offline
        AcerExtensa
        wrote on last edited by
        #3

        If you need utility to extract images, you can try Restorator 2007.
        If you need sample how to do that in Qt, look "here":http://developer.qt.nokia.com/doc/qt-4.8/qresource.html

        God is Real unless explicitly declared as Integer.

        1 Reply Last reply
        0
        • A Offline
          A Offline
          andre
          wrote on last edited by
          #4

          I don't see an example of using Resorator on that page?

          1 Reply Last reply
          0
          • A Offline
            A Offline
            AcerExtensa
            wrote on last edited by
            #5

            Who has told where is an example using Restorator on that page? O_o

            God is Real unless explicitly declared as Integer.

            1 Reply Last reply
            0
            • A Offline
              A Offline
              andre
              wrote on last edited by
              #6

              [quote author="AcerExtensa" date="1329755145"]Who has told where is an example using Restorator on that page? O_o
              [/quote]
              Well, if my understanding of the English language is correct (I am not a native speaker, so I might be off), the highlighted 'that' in the second sentence of the quote below refers to the 'extracting of images' from the first sentence.
              [quote author="AcerExtensa" date="1329754537"]If you need utility to extract images, you can try Restorator 2007.
              If you need sample how to do that in Qt, look "here":http://developer.qt.nokia.com/doc/qt-4.8/qresource.html[/quote]

              Hence, in my understanding, you wrote that there would be an example of extracting images behind the link. Otherwise, what does 'that' refer to exactly?

              1 Reply Last reply
              0
              • A Offline
                A Offline
                AcerExtensa
                wrote on last edited by
                #7

                ahm, but I wrote "how to do that in Qt . ", and not just "how to do that . "
                But, maybe you are right, I'm not native english speaker too :D

                Anyway, with

                bq. how to do that in Qt

                I meant, how to extract Resources from Libraries(etc...) with help of Qt Framework... :D

                God is Real unless explicitly declared as Integer.

                1 Reply Last reply
                0
                • G Offline
                  G Offline
                  goetz
                  wrote on last edited by
                  #8

                  If you look at the qrc_xxx.cpp source file, it contains some static data. The actual images are in qt_resource_data. One could try to find the offeset in the executable at wich that block of data starts and then read the data out of the file. The format is quite simple.

                  http://www.catb.org/~esr/faqs/smart-questions.html

                  1 Reply Last reply
                  0
                  • Q Offline
                    Q Offline
                    qtik5
                    wrote on last edited by
                    #9

                    Thanks for all who are contributing to this topic. Unfortunately I haven't had any joy with any of the suggestions. I have now gone down the route of using a hex editor to edit the EXE file and extract the required jpeg sections by identifying the start and end markers FFD8 and FFD9 respectively of an embedded jpeg. However the resulting jpeg file is being reported as corrupt and am unable to open it using many different graphics applications. I guess the reason for that is because the header information which should identify the file as jpeg i.e. JFIF is either missing or was converted at compile time to something which is specific to Qt environment only.
                    Good header: FF D8 FF E0 00 10 4A 46 49 46 00 01 00 01 01 2C where 4A 46 49 46 corresponds to JFIF.
                    Not-so-good header (from my EXE file): FF D8 70 79 09 59 26 2A 60 46 AC F7 00 as you can see the 4 bytes (4A 46 49 46) corresponding to JFIF in the good header is missing here.
                    Does anyone know if Qt manipulates jpeg headers before embedding them in to EXE files?

                    1 Reply Last reply
                    0
                    • G Offline
                      G Offline
                      goetz
                      wrote on last edited by
                      #10

                      The files are stored "as is". qrc does not manipulate the contents. While stand alone qrc files (to be loaded after application startup) can be compressed, the compiled in resources are one to one copies of the bytes of the files on the disk. For qrc it's only files, it is not aware of the concept of images or the like.

                      http://www.catb.org/~esr/faqs/smart-questions.html

                      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