• Welcome to SC4 Devotion Forum Archives.

Simple FSH<>PNG Tools

Started by Jonathan, March 02, 2009, 12:11:11 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.


I don't know if it's useful to anyone else, but I made it because other FSH Tools took to long, when I just quickly wanted to Convert FSH to BMP,
Just open the FSH with the Tool you get 3 buttons Bitmap Only, Bitmap and Alpha and Alpha Only, click what you want and the BMP appears almost immediately in the same location as the FSH file with the same name.
If anyone's interested post and then download the program in the attachment(includes Vista FSHLib.dll(should work on non Vista) :)



Ohh a clever sounding little tool &apls
I'd be interested ::)

Kettle's on. Milk? Sugars?    ps I don't like Earl Grey  $%Grinno$%
Reduce, Reuse, Recycle - If you're not part of the solution , you're part of the problem!
"Never knock on Death's door: Ring the bell and run away! Death really hates that!"
Tales at TeaTime      Now A proper NUT      TTC plays GRV II


Very nice, I would be interested too  :thumbsup:
New Horizons Productions
Berethor - beskhu3epnm - blade2k5 - dmscopio - dedgren - Emilin - Ennedi
jplumbley - moganite - M4346 - nichter85 - papab2000 - Shadow Assassin - Tarkus - wouanagaine


Cool. How does that work? Do you simply have to drag the FSH file onto the program window to open it, or do you have to select the file via a menu/dialogue? What about making those buttons a "hotspot" where you can drag the FSH onto, and it will be converted immediately?


I'll just attach to the post :)
btw, it includes the Vista FSHLib.dll, but I'm not 100% sure if it works on XP.

You have to open the the FSH with the program, so like either set it as the default program or right click, open with, FSH To BMP.

But you can't open the program directly and then open the FSH File.
Hotspots is an idea, I'll try making that but I think it will be beyond my programming knowledge :)




Quote from: Warrior on March 02, 2009, 12:53:38 PM
Hotspots is an idea, I'll try making that but I think it will be beyond my programming knowledge :)

Well, any programming knowledge is beyond me, so I have no idea how complicated that could be. All I know is that such programs do exist (i. e. for converting audio files), and for converting FSH files, it seem to be a nice trick. Assigning the FSH files to your program and opening them via double-click is pretty much as fast as well, though, so there's no need to dig any further. :)


Nice to see more and more programmers are in :)
good job  :thumbsup:

New Horizons Productions
Berethor ♦ beskhu3epnm ♦ blade2k5 ♦ dmscopio ♦ dedgren ♦ emilin ♦ Ennedi ♦ Heblem ♦ jplumbley
M4346 ♦ moganite ♦ Papab2000 ♦ Shadow Assassin ♦ Tarkus ♦ wouanagaine
Divide wouanagaine by zero and you will in fact get one...one bad-ass that is - Alek King of SC4


 :thumbsup: Great job Jonathan! Works as advertised (in Vista at least)! I am amazed constantly amazed  by all the things that get produced for this game!



Works on WinXP.

It should work on Win98 or newer   :P

The vista friendly version should now have its own version number, to tell it apart from the non vista friendly versions.

The new FSHLib vista version: http://sc4devotion.com/forums/index.php?topic=5142.msg221467#msg221467

Any chance the vista friendly version can be uploaded to the LEX?


awesome that your programming Jon :)

any chance of the code? :D

Copperminds and Cuddleswarms


Joe, We'll its the first thing I made I actually find useful ;)

Yep I could it's quite short (and probably not written in the best way), and its VB  :)



Buttons that are "hotspot" meaning you can drag & drop files onto them are fairly easy to make when using the AllowDrop file property in the Visual Studio designer.  ;)

In an demo I made the only purpose of the buttons was to drop fsh files to convert onto.  :thumbsup:


I got the dropping to work, but didn't know how to get the DropData into a Stream, and couldn't find anything about it anywhere, so I kind of gave up :)




if it helps the code that i used for dropping is:

   private void button2_DragDrop(object sender, DragEventArgs e)
            string[] files = (string[])e.Data.GetData(DataFormats.FileDrop);

            foreach (string file in files)
                FileInfo fi = new FileInfo(file);
                if (fi.Exists)
                    if (fi.Extension.Equals(".fsh"))
                        FSHImage fsh = new FSHImage();
                        BitmapItem bi = new BitmapItem();
                        FileStream fstream = new FileStream(fi.FullName, FileMode.Open);

                        string path = Path.GetDirectoryName(Application.ExecutablePath);
                        bi = (BitmapItem)fsh.Bitmaps[0];

                        bi.Bitmap.Save(Path.Combine(path, Path.GetFileNameWithoutExtension(fi.FullName) + ".png"), ImageFormat.Png);
                        bi.Alpha.Save(Path.Combine(path, Path.GetFileNameWithoutExtension(fi.FullName) + "_a.png"), ImageFormat.Png);



Folks, I'm getting a "This is not a valid BMP/DIB/RLE file." message in PSP when I try to open the files that are output.  Everything else appears to work as described.  I run 64-bit Vista.

D. Edgren

Please call me David...

Three Rivers Region- A collaborative development of the SC4 community
The 3RR Quick Finder [linkie]

I aten't dead.  —  R.I.P. Granny Weatherwax

Skype: davidredgren


That is strange,I get the same error in PSP8,Photoshop CS2 gives "could not complete your request because the file-format module cannot parse the file".
I also am on Vista 64 , the Windows photo gallery does open the file though.



I could make a new FSH->BMP tool in the weekend. It should have a batch FSH->BMP function too.

Warior, do you have any documentation of this dll (functions, arguments, description etc), and an import library? How did you know what is available in there?