-1

I have .fla files that use XFL format. inside there's a /bin folder with some .dat files, these files are images.

is there a way to convert these .dat file to bitmap and display them in PictureBox control?

here's an example of a dat file: link

And the corresponding image (exported from Flash) link

UPDATE: below my code:

string scenePath = "Path to .fla file";
ZipFile zip = new ZipFile(scenePath);
MemoryStream ms = new MemoryStream();

foreach (ZipEntry entry in zip)
{
    if (entry.FileName.Contains(objName))
    {
        entry.Extract(ms);

        //TODO: Need to convert the content of MemoryStream to image type!

        Bitmap bmp = new Bitmap(ms);
        pictureBoxObjView.Image = bmp;
    }
}

UPDATE2: I found a post that describe a similar issue XFL - What are the ./bin/*.dat files?. in the answer I found this :

where the decompressed data are pixels with storage type: ARGB, so with the size info it should be enough to get the image from it. It's using ZLIB compression (www.zlib.net) Flash is using compression level 1, but it's possible to use any level (but it's not necessary as the sources are normally compressed altogether.

but I still don't undestand how to convert the .dat file to bitmap !!

I tried manualy to uncompress the .fla and rename the .dat file to image ext (.jpg, .png, .bmp) to check if it's a normal image file, but I got the error "Incorrect format" when I try to open it.

My problem is how to convert the content of my MemoryStream to Bitmap?

Regards,

Community
  • 1
  • 1

1 Answers1

1

If you can extract the files from the /bin folder into a stream or byte array (which would then be encapsulated in a stream) you could call the corresponding Bitmap constructor and simply assign this bitmap to the image property of the PictureBox.

Oliver
  • 43,366
  • 8
  • 94
  • 151
  • thank you for the quick answer :) I already tried this solution, but it doesn't work :( Apparently adobe change image format in the dat file, I found this post [link](http://stackoverflow.com/questions/4082812/xfl-what-are-the-bin-dat-files) that describe the /bin folder inside fla. but I didn't understand how to get the dat file to bitmap object. – rachid.elidrissi Jun 23 '15 at 13:09
  • So your problem is how to convert the .dat file into a bitmap. Maybe you should refine your question and add a sample .dat file to it. Additionally maybe add the resulting image file, by saving it as a native image through one of adobe tools that is capable of reading the file out of that xfl file. – Oliver Jun 23 '15 at 13:18
  • I updated my post, and add link to dat file – rachid.elidrissi Jun 23 '15 at 14:11