February 20, 2012

qtik5 qtik5
Lab Rat
2 posts

Extract embedded resources

 

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.

9 replies

February 20, 2012

Andre Andre
Area 51 Engineer
6031 posts

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.

 Signature 

Looking for Qt developers to join our team @ i-Optics: https://qt-project.org/forums/viewthread/25393/

February 20, 2012

AcerExtensa AcerExtensa
Robot Herder
567 posts

If you need utility to extract images, you can try Restorator 2007.
If you need sample how to do that in Qt, look here [developer.qt.nokia.com]

 Signature 

God is Real unless explicitly declared as Integer.

February 20, 2012

Andre Andre
Area 51 Engineer
6031 posts

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

 Signature 

Looking for Qt developers to join our team @ i-Optics: https://qt-project.org/forums/viewthread/25393/

February 20, 2012

AcerExtensa AcerExtensa
Robot Herder
567 posts

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

 Signature 

God is Real unless explicitly declared as Integer.

February 20, 2012

Andre Andre
Area 51 Engineer
6031 posts
AcerExtensa wrote:
Who has told where is an example using Restorator on that page? O_o
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.
AcerExtensa wrote:
If you need utility to extract images, you can try Restorator 2007. If you need sample how to do that in Qt, look here [developer.qt.nokia.com]

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?

 Signature 

Looking for Qt developers to join our team @ i-Optics: https://qt-project.org/forums/viewthread/25393/

February 20, 2012

AcerExtensa AcerExtensa
Robot Herder
567 posts

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

how to do that in Qt

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

 Signature 

God is Real unless explicitly declared as Integer.

February 21, 2012

Volker Volker
Robot Herder
5428 posts

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.

February 21, 2012

qtik5 qtik5
Lab Rat
2 posts

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?

February 21, 2012

Volker Volker
Robot Herder
5428 posts

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.

 
  ‹‹ is it possible to split a particular collumn into subcolumn in table widget?      [Solved] How to make multi QPushButton to activate slot ››

You must log in to post a reply. Not a member yet? Register here!