Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to get image files out of ImageListStreamer in resx?

Ann app I work on gets some of it icons from a serialised ImageList object in a .resx file. This sucks to maintain because I can't edit or even see the images from Visual Studio.

How can I get the images back as files (PNGs or bitmaps)? Then I can use them instead and delete the pesky ascii resource.


<data name="imageList.ImageStream" mimetype="application/x-microsoft.net.object.binary.base64">
    <value>
        AAEAAAD/////AQAAAAAAAAAMAgAAAFdTeXN0ZW0uV2luZG93cy5Gb3JtcywgVmVyc2lvbj0yLjAuMC4w
        ...
        A///AAIACw==
    </value>
</data>

(The full ascii text is hundreds of lines long)

like image 330
Colonel Panic Avatar asked Sep 12 '25 18:09

Colonel Panic


2 Answers

I had somehow similar problem - but I needed to extract data like this:

<data name="barButtonItem.LargeGlyph" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>
   iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAABGdBTUEAALGPC/xhBQAAAAlwSFlzAAAL

...

I've googled for "mime64 to binary file online", jumped from there into first mime64 decoder - for example like this: http://www.motobit.com/util/base64-decoder-encoder.asp

and then decoded mime64 to plain binary. Saved with .png extension - and voila - I have image now back.

I guess similar approach could be tried on on icons, but not sure if this will work on them. May be some sort of hex binary cut paste might be needed as well.

like image 125
TarmoPikaro Avatar answered Sep 15 '25 07:09

TarmoPikaro


I've had the same problem and I found a handy solution here.

With ResXResourceReader you can read the file and enumerate it.

like image 25
Rene Hilgers Avatar answered Sep 15 '25 09:09

Rene Hilgers