Sim City 4 Devotion Forums

Sim City 4 Devotion Tools => Tools - General Discussion => Topic started by: Jonathan on March 02, 2009, 02:11:11 PM

Title: Simple FSH<>PNG Tools
Post by: Jonathan on March 02, 2009, 02:11:11 PM
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) :)

(http://i200.photobucket.com/albums/aa230/warriorST/F2B.jpg)

Jonathan
Title: Re: Simple FSH to BMP tool
Post by: TheTeaCat on March 02, 2009, 02:26:34 PM
Ohh a clever sounding little tool &apls
I'd be interested ::)

 :satisfied:
TTC
Title: Re: Simple FSH to BMP tool
Post by: Ennedi on March 02, 2009, 02:36:44 PM
Very nice, I would be interested too  :thumbsup:
Title: Re: Simple FSH to BMP tool
Post by: Andreas on March 02, 2009, 02:43:25 PM
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?
Title: Re: Simple FSH to BMP tool
Post by: Jonathan on March 02, 2009, 02:53:38 PM
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 :)

Jonathan
Title: Re: Simple FSH to BMP tool
Post by: Rayden on March 02, 2009, 03:04:49 PM
Thx Jonathan :thumbsup:
Title: Re: Simple FSH to BMP tool
Post by: Andreas on March 02, 2009, 03:21:34 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. :)
Title: Re: Simple FSH to BMP tool
Post by: wouanagaine on March 02, 2009, 03:36:22 PM
Nice to see more and more programmers are in :)
good job  :thumbsup:
Title: Re: Simple FSH to BMP tool
Post by: sithlrd98 on March 02, 2009, 05:51:30 PM
 :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!

Jayson
Title: Re: Simple FSH to BMP tool
Post by: null45 on March 02, 2009, 07:50:58 PM
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 (http://sc4devotion.com/forums/index.php?topic=5142.msg221467#msg221467)


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

Title: Re: Simple FSH to BMP tool
Post by: JoeST on March 03, 2009, 04:02:48 AM
awesome that your programming Jon :)

any chance of the code? :D

Joe
Title: Re: Simple FSH to BMP tool
Post by: Jonathan on March 03, 2009, 11:16:50 AM
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  :)

Jonathan
Title: Re: Simple FSH to BMP tool
Post by: null45 on March 04, 2009, 10:02:14 PM
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:
Title: Re: Simple FSH to BMP tool
Post by: Jonathan on March 05, 2009, 01:03:27 AM
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 :)

Jonathan
Title: Re: Simple FSH to BMP tool
Post by: superhands on March 05, 2009, 01:13:50 AM
nice work jon.  ;D
Title: Re: Simple FSH to BMP tool
Post by: null45 on March 05, 2009, 08:22:33 AM
if it helps the code that i used for dropping is:

Code: [Select]
   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);
                        fsh.Load(fstream);
                        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);
                    }
                }
               
            }

        }
Title: Re: Simple FSH to BMP tool
Post by: dedgren on March 05, 2009, 09:45:02 AM
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.


David
Title: Re: Simple FSH to BMP tool
Post by: Jonathan on March 05, 2009, 11:15:09 AM
I tried it in paint and GIMP and paint and it works, could you try it in one of them as well?

Jonathan
Title: Re: Simple FSH to BMP tool
Post by: sithlrd98 on March 05, 2009, 12:23:57 PM
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.

Jayson

Title: Re: Simple FSH to BMP tool
Post by: cogeo on March 05, 2009, 12:40:05 PM
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?
Title: Re: Simple FSH to BMP tool
Post by: Jonathan on March 05, 2009, 12:58:06 PM
Cogeo, this tool is a FSH > BMP tool,
I didn't find any documentation, so it took quite a while of trial, error and google.

I have tried to make a BMP to FSH Tool but that seems much harder to code, I'll attach the source code, what is the best format, the VB project or just a text file file of the class?

EDIT: here's the basic FSH function

Code: [Select]
   Function LoadFSH(ByVal file)
        Dim Fsh As New FSHLib.FSHImage
        Dim stream As System.IO.Stream
        stream = IO.File.OpenRead(file)
        Fsh.Load(stream)
        Dim FSHBMP As FSHLib.BitmapItem
        FSHBMP = Fsh.Bitmaps.Item(0)
        Return FSHBMP
        r.Close()
    End Function

Then to get the bitmap and alpha's(respectively):
(NB: "My.Application.CommandLineArgs(0)" is the location of the FSH file you want to convert to bmp.)
Code: [Select]
LoadFSH(My.Application.CommandLineArgs(0)).Bitmap.Save(bitmapsaveloc)
LoadFSH(My.Application.CommandLineArgs(0)).Alpha.Save(alphasaveloc)

It seems there can be more than one bitmap in a FSH, but in SC4 this isn't used.

Jonathan

Title: Re: Simple FSH to BMP tool
Post by: cogeo on March 05, 2009, 01:27:12 PM
Aaah, I see, this is a library with a VB Object.

Btw, there are multi-image FSH files in the simcity dats. If used as lot textures, the game selects one of the images randomly.
Title: Re: Simple FSH to BMP tool
Post by: dedgren on March 05, 2009, 01:37:30 PM
Well, that's something.  My converted file opens just fine in Paint.

And...

...checking, checking...

...when I save it as a PNG from Paint, it opens just fine in PSP.

Well, that works.  Kinda sorta.

But, great job!  I was pretty worried about Vista and FSH files.


David
Title: Re: Simple FSH to BMP tool
Post by: Jonathan on March 05, 2009, 03:55:34 PM
I was thinking of trying to add a png button in, that has an alpha included but can't find out how to do it.
I have an idea about the PSP thing, but will try it out some other time.
Also I've made a bulk version, which is attached below

Needs the FSHLib.dll which you can get in Null 45's post or the download in the first post.

Thanks for all your feedback so far, please give more on both programs, what you like and what you'd like changed, and then I'll do my best to learn how to do that.


David, try renaming the .bmp to .png, because maybe PSP is expecting a bmp but actaully the prgram is not saving it in bmp format?

Jonathan
Title: Re: Simple FSH to BMP tool
Post by: null45 on March 05, 2009, 04:37:23 PM
Bitmap.Save(bitmapsaveloc,ImageFormat.Bmp) is the method used to tell it to save in bmp format.

Is the drag & drop file conversion working Warrior?  :thumbsup:



Title: Re: Simple FSH to BMP tool
Post by: Andreas on March 05, 2009, 04:53:33 PM
Well, personally, I prefer PNG over BMP at any time, as PNG supports transparency. Of course texture transparency is handled via alpha maps in the game, but when editing overlays, having the source file with transparency in the first place is very helpful, rather than the need of using the alpha map in the graphics program as well for creating masks.
Title: Re: Simple FSH to BMP tool
Post by: sithlrd98 on March 05, 2009, 05:03:49 PM
I was going to ask for a .png as well , but since this is an early attempt , I didn't want to push my luck :D

Also , I am using the FSHLib.dll that came with your program and still get the same errors: but if I change to .png , it opens in both PS and CS2.

Jayson
Title: Re: Simple FSH to BMP tool
Post by: wes.janson on March 05, 2009, 05:04:24 PM
I agree with Andreas. I don't even use BMPs for my textures anymore. PNGs for the actual in game textures and psp for developing as it doesn't merge the layers in PSPXI
Title: Re: Simple FSH to BMP tool
Post by: null45 on March 05, 2009, 05:38:28 PM
Quote
Also , I am using the FSHLib.dll that came with your program and still get the same errors: but if I change to .png , it opens in both PS and CS2.

What do you mean by getting errors?

If you meat that PSP is not able to load the saved bmp, that means it probably was not saved correctly or is invalid.

Or it is valid and PSP just doesn't like the bmp file.   ::)

If that is the case FSHLib.dll has nothing to do with the errors.

I agree that Png is better than Bmp, the demo I wrote saves as Png.
Title: Re: Simple FSH to BMP tool
Post by: sithlrd98 on March 05, 2009, 05:52:12 PM
Sorry , the errors were posted on previous page. I only added the part about the .dll because I wasn't sure who Jonathan was directing in his prior post. But, like I said , if I change the newly created .bmp to a .png , both photo editors are able to read it.

Jayson
Title: Re: Simple FSH to BMP tool
Post by: null45 on March 05, 2009, 06:16:52 PM
Quote
David, try renaming the .bmp to .png, because maybe PSP is expecting a bmp but actaully the prgram is not saving it in bmp format?

That is correct the files are being saved as a png with a .bmp extension.

The code
Code: [Select]
LoadFSH(My.Application.CommandLineArgs(0)).Bitmap.Save(bitmapsaveloc)
should be
Code: [Select]
LoadFSH(My.Application.CommandLineArgs(0)).Bitmap.Save(bitmapsaveloc,ImageFormat.Bmp)
or you could change the extention to png in the code that you set the file extension in. 
Title: Re: Simple FSH to BMP tool
Post by: Jonathan on March 06, 2009, 01:21:25 AM
Thanks Null,
I have changed the code in both programs, so now it saves it as png format and with png extension, but there is still no option to have the alpha and bmp in one png file, I need to find out how to do that :)

And I haven't added the drag and drop yet, but I will later today/tommorrow


Jonathan
Title: Re: Simple FSH to BMP tool
Post by: dedgren on March 06, 2009, 12:18:30 PM
Hi, null45 and Jonathan-

Would it be possible (and not too much trouble) to make a parallel tool that goes in the other direction?  I would like an easy way to turn PNG files into FSH files, and in particular 256x256 pixel PNG files into 256x256 pixel FSH files.  The SC4Tool is limited to processing 128x128 pixel files.

Thanks for this great addition to the MODding toolbox.


David
Title: Re: Simple FSH to BMP tool 6.1.0.0
Post by: Jonathan on March 06, 2009, 01:50:12 PM
Well it actually isn't converting the FSH to PNG, more like extracting the PNG from the FSH, and putting a PNG into a FSH seems harder, as I think you might have to 'build' the FSH(FSH is not a standard image(or whatever it is) format, I've looked at it and it isn't as simple as FSH to PNG.

Null45, you can probably help here?

EDIT: Update of ClickFSHToPNG to 6.1.0.0, now there is drag and drop functionality added. You can open the program directly, or just open it from a FSH file and drag any FSH file on it. Also if you open the program directly you can make it the topmost (it stays on top of other windows) so extracting lots of FSH is easier.

Jonathan
Title: Re: Simple FSH to BMP tool
Post by: null45 on March 06, 2009, 03:39:12 PM
Do you mean a tool that you drag a fsh file onto and then drag a bitmap to replace the existing bitmap in the fsh?

As to creating a completely new fsh, updating the bitmap / alpha & saving under a different file name would work.   

Edit:

 (http://img8.imageshack.us/img8/2568/h257z5.png)

A little demo. ;)
Title: Re: Simple FSH to BMP tool
Post by: Jonathan on March 22, 2009, 11:15:28 AM
Here's a new version, a lot of the changes are not (well shouldn't be) noticeable, it has just been to compact the code and remove duplicate sections.

But when opening the program from a FSH file (not drag and drop only), if you hover over any of the three buttons you'll get a preview of the image.
And you can turn the messages that pop up after you've finished on or off.

Jonathan
Title: Re: FSH2PNG MkII
Post by: Jonathan on April 17, 2009, 03:40:41 AM
Thanks to null45 who gave me a dll he made to make blended pngs, now I've made another tool that has no buttons, just open the file(s) with the program and it will convert them into blended pngs (so alpha and bitmap in one file)

You can also select multiple files and it will convert all of them.
And you must have version 0.3.1.31964 of the FSHLib.dll(included in the zip)

Jonathan

Title: Re: Simple FSH<>PNG Tools
Post by: SimGoober on May 01, 2009, 04:46:45 PM
Very cool tool!  Just what I needed for a quick project... new overlay textures based on previous ones.
Title: Re: Simple FSH<>PNG Tools
Post by: puresim on January 13, 2010, 06:06:50 PM
Hi guys. I'm running Windows XP SP3 but am having trouble getting any FSH to PNG programs to work. Even FISHMAN with the 0.3.1.32186 version of FSHLib.dll gives me errors.

I double click on the FSH2PNG MkII.exe file and it just shows me this:
(http://i173.photobucket.com/albums/w73/purepics/GHRRRRRRRRRRRRRR.jpg)

I've downloaded it twice but still get the same window. Could someone explain how this works?
Title: Re: Simple FSH<>PNG Tools
Post by: null45 on January 13, 2010, 11:23:00 PM
With FSH2PNG MkII you have to drag and drop the fsh to be converted onto the program then it will convert it, the program would display that message box even if it was not given any files to convert.


(http://img63.imageshack.us/img63/5491/crasho.png)
FSH2PNG MkII will also crash with this dialog the fsh is invalid.
Title: Re: Simple FSH<>PNG Tools
Post by: puresim on January 14, 2010, 04:19:51 PM
Sorry for the delay. I do get that error dialog when I drop the fsh files.

(http://i173.photobucket.com/albums/w73/purepics/SC4/error.jpg)

Seems like Reader isn't saving the files properly. Thanks null45, I'll try to work it out.
Title: Re: Simple FSH<>PNG Tools
Post by: Jonathan on January 16, 2010, 06:11:43 PM
I'm sorry I have no idea why you are getting that error, could you attach the FSH file that produced the error?

Anyway I have made a new program which does as the title of this thread says FSH<>PNG you just open a file, whether it is a PNG of FSH. And you can copy it to the clipboard as a file (.png) or a image which you can paste into a program such as paint. Also you can bulk convert and you can edit a FSH (and if you really want to a PNG) in an external app such as Paint/Photoshop and save it as a FSH without having to convert it yourself.
And it will eventually have the same drag and drop feature as the previous app did:
(http://i200.photobucket.com/albums/aa230/warriorST/newFSHtool.jpg)

Jonathan
Title: Re: Simple FSH<>PNG Tools
Post by: null45 on January 17, 2010, 12:44:38 AM
The program would not crash if the code is encased in a try catch block eg.

Code: [Select]
<STAThread()> _
    Public Shared Sub Main(ByVal args As String())
        Try
            ' is there an image to convert
            If args.Length > 0 Then
                For Each a As String In args
                    Dim fi As New FileInfo(a)
                    Using fs As New FileStream(fi.FullName, FileMode.Open, FileAccess.Read)
                        Dim fsh As New FSHImage(fs)
                        Dim bi As BitmapItem = DirectCast(fsh.Bitmaps(0), BitmapItem)
                        Dim bl As New BlendBitmap()
                        Dim bmp As Bitmap = bl.BlendBmp(bi)
                        bmp.Save(Path.Combine(fi.DirectoryName, String.Concat(Path.GetFileNameWithoutExtension(fi.Name), ".png")))
                    End Using
                Next
            Else
                Interaction.MsgBox("An image must be dragged onto the program to convert it", MsgBoxStyle.Information, "No image to convert")
            End If
        Catch ex As Exception
            Interaction.MsgBox(ex.Message, MsgBoxStyle.Critical, "Error converting file")
        End Try
    End Sub

Hopefully that helps.  :thumbsup:
Title: Re: Simple FSH<>PNG Tools
Post by: puresim on January 17, 2010, 02:02:46 PM
I'm sorry I have no idea why you are getting that error, could you attach the FSH file that produced the error?

It's not just this program that can't open the fsh files (i.e. nothing to do with your scripting!). Here (edit: removed link) are 2 fsh files I've just saved from texture viewer in Reader, both produce the error message when dragged onto FSH2PNG.

If I'm honest I gave up trying to get it to work and just started working on another building model. My computer is telling me I have .NET framework 1, 2, 3 and 3.5 - Not sure if that is normal.

btw Jonathan I'm very interested in your new program, would be great if that worked for me.
Title: Re: Simple FSH<>PNG Tools
Post by: null45 on January 17, 2010, 08:05:58 PM
Both of those fsh files are valid and work fine for me.

What error does FiSHMan give?

Title: Re: Simple FSH<>PNG Tools
Post by: puresim on January 18, 2010, 01:53:22 PM
In desperation I reinstalled Fishman and the FSHLib.dll file last night and finally got it to open my fsh files. I still get the same error from FSH2PNG though.

FiSHman was giving me an invalid file error before, but the new installation seems fine. Thanks for your help guys :)
Title: Re: Simple FSH<>PNG Tools
Post by: Jonathan on January 18, 2010, 02:14:29 PM
are you using the same FSHLib.dll in both programs, try copying the one from FiSHMan folder to the FSH2PNG folder.

They work fine with the FSH2PNG on my PC.
Title: Re: Simple FSH<>PNG Tools
Post by: puresim on January 18, 2010, 02:48:26 PM
This is embarassing but that just worked &ops I was 99.9% sure that was the latest FSHLib.dll file!

Thanks all!
Title: FSH Converter Tool
Post by: Jonathan on February 15, 2010, 12:09:59 PM
The whole point of this tool was to make converting FSH to PNG and back to FSH again just to edit it redundant. But I got a little carried away

So this program does the same as FSH2PNG, as well as have a proper interface.

To convert FSH(s) to PNG in the same style as FSH2PNG, all you have to do is drop the FSHs onto the program icon, and hold the Control Key down as you do so. Or set the program as the default for FSH and hold Control as you open them.

Another option is to use the FSHPNGConverter - Quick Convert icon. This is just a short cut to FSHPNGConverter with the command line arguement /c.

If you don't hold Control down then it opens the FSHPNGConverter and puts the FSHs you dropped on the icon or opened into the list in the left.

To edit a FSH without converting it back and forth (the program does this automatically for you) open it in FSHPNGConverter and the select it in the list, then click Edit in App button. This lets you select the program you want to open it in (say photoshop). After that the FSHPNGConverter dissapears and the program will load with the FSH open in it. Then When you are done click save and the close (please remember to save :)). The FSHPNGConverter will reappear with the edited FSH in it. You can then click Save to save it a FSH. (So you must save it in the editing program and FSHPNGConverter )

Saving the FSH:
There are different Types of FSH, uncompressed/compressed and alpha/no-alpha and the combinations of the two. in FSHPNGConverter you just select Compressed or Uncompressed from the combobox at the bottom right.
It will see if there is an alpha or not.
The default is compressed.

You can also copy the FSH as a PNG file (that you can paste into explorer) onto the clipboard
Or copy the FSH as an image (that you can paste into MS paint etc) onto the clipboard.

You can also drag and drop FSH/PNGs onto the listview. And the program can have PNGs dragged onto it's icon/opened with it.

(http://i200.photobucket.com/albums/aa230/warriorST/FSHPNGConverter.jpg)

Jonathan
Title: Re: Simple FSH<>PNG Tools
Post by: puresim on February 15, 2010, 02:13:33 PM
That's a lot of useful new features! :thumbsup: Looks really simple to use from the screenshot - Where can we download it from?
Title: Re: Simple FSH<>PNG Tools
Post by: Jonathan on February 22, 2010, 04:38:37 PM
I run into a last minute problem, that I need to fix but don't have the time until this weekend.
Title: FSH Converter Tool - Attached
Post by: Jonathan on February 28, 2010, 04:06:45 AM
Here is the FSHConverter Tool, finally got round to fixing the issue.

The whole point of this tool was to make converting FSH to PNG and back to FSH again just to edit it redundant. But I got a little carried away

So this program does the same as FSH2PNG, as well as have a proper interface.

To convert FSH(s) to PNG in the same style as FSH2PNG, all you have to do is drop the FSHs onto the program icon, and hold the Control Key down as you do so. Or set the program as the default for FSH and hold Control as you open them.

Another option is to use the FSHPNGConverter - Quick Convert icon. This is just a short cut to FSHPNGConverter with the command line arguement /c.

If you don't hold Control down then it opens the FSHPNGConverter and puts the FSHs you dropped on the icon or opened into the list in the left.

To edit a FSH without converting it back and forth (the program does this automatically for you) open it in FSHPNGConverter and the select it in the list, then click Edit in App button. This lets you select the program you want to open it in (say photoshop). After that the FSHPNGConverter dissapears and the program will load with the FSH open in it. Then When you are done click save and the close (please remember to save :)). The FSHPNGConverter will reappear with the edited FSH in it. You can then click Save to save it a FSH. (So you must save it in the editing program and FSHPNGConverter )

Saving the FSH:
There are different Types of FSH, uncompressed/compressed and alpha/no-alpha and the combinations of the two. in FSHPNGConverter you just select Compressed or Uncompressed from the combobox at the bottom right.
It will see if there is an alpha or not.
The default is compressed.

You can also copy the FSH as a PNG file (that you can paste into explorer) onto the clipboard
Or copy the FSH as an image (that you can paste into MS paint etc) onto the clipboard.

You can also drag and drop FSH/PNGs onto the listview. And the program can have PNGs dragged onto it's icon/opened with it.

(http://i200.photobucket.com/albums/aa230/warriorST/FSHPNGConverter.jpg)

Jonathan

Jonathan
Title: Re: Simple FSH<>PNG Tools
Post by: null45 on February 28, 2010, 02:12:16 PM
Getting a System.NullReferenceException when the form loads, it will run if continue is clicked.

Title: Re: Simple FSH<>PNG Tools
Post by: Jonathan on February 28, 2010, 02:16:11 PM
Great, that's what I though I'd fixed.

EDIT: Forgot a Not :)

I've updated it and it's attached to the same post,
Title: Re: Simple FSH<>PNG Tools
Post by: null45 on February 28, 2010, 02:29:55 PM
The Alpha from Transparency code contains another bug, it would not set the alpha map on semi-transparent sections of an image.

The fixed code is:

Code: [Select]
    While testbmp.GetPixel(x, y).A < 255
        testbmp.SetPixel(x, y, Color.FromArgb(srcpxl.A, srcpxl.A, srcpxl.A))
   End While

Title: Re: Simple FSH<>PNG Tools
Post by: Jonathan on February 28, 2010, 02:31:35 PM
Are you saying I should replace this:
Code: [Select]
  While testbmp.GetPixel(x, y).A = 0 AndAlso testbmp.GetPixel(x, y).R = 0
                    testbmp.SetPixel(x, y, Color.Black)
                End While
with that? Because you gave me this code.

And I'm not really sure what you mean by it would not set the alpha map on semi-transparent sections of an image? Is that opening or saving a FSH or a PNG?
Title: Re: Simple FSH<>PNG Tools
Post by: null45 on February 28, 2010, 02:44:09 PM
It would be all of them.

The 24-bit fsh would need to have its alpha reset to white when loaded or it would cause the image to disappear when Alpha Blended.


Title: Re: Simple FSH<>PNG Tools
Post by: Jonathan on March 05, 2010, 05:22:29 PM
Well I fixed the semi-transparency thing, though I didn't use your code as I said in the PM. Please let me know if that was wrong :)

Also added in a show Alpha button which shows you the alpha of the selected image (not when you've selected multiple though) in a little toolbox type window.

Also lets you save in 24-bit uncompressed properly, and thanks to null45's fix he sent me ages ago you can now open 24-bit uncompressed FSHs and they will be correct.

Before I reupload I'm going to add a an "Add alpha to image" button so that you can open a bitmap then right click it and choose an alpha for it.

Also going to add a quick edit feature, which works the same the quick convert does and will allow you to open in programs that do not support photoshop without seeing any of the FSHConverter program.

Also change the way the compression setting works, by making it remember if the FSH you opened was compressed or not. And make it easier to see which are compressed and which aren't.

Jonathan
Title: Re: Simple FSH<>PNG Tools
Post by: puresim on March 06, 2010, 08:30:41 AM
Sounds good mate, looking forward to it :thumbsup:
Title: Re: Simple FSH<>PNG Tools
Post by: Jonathan on April 24, 2010, 04:23:02 AM
Much smaller easier tool, going back to what I was originally wanting (simple tools to use FSH files)

Simply adds a convert button to the context menu and explorer bar to convert the FSH:
(http://dl.dropbox.com/u/2969879/Pictures/FSHMenu.png)
Title: Re: Simple FSH<>PNG Tools
Post by: wes.janson on May 07, 2010, 10:51:02 PM
How did it take me 2 weeks to find this out. Thanks Jonathan... the right-click option is wonderful!  &apls
Title: Re: Simple FSH<>PNG Tools
Post by: null45 on May 08, 2010, 12:08:35 AM
Why is it claiming that Microsoft wrote it?  ::)

Title: Re: Simple FSH<>PNG Tools
Post by: Jonathan on May 08, 2010, 04:31:04 AM
Ah, great I'd thought I'd changed all that. :)