I need to create a software that it merge many GIF File into one file container.
My application has this form
I want that when i click "Add File" it shows an OpenFileDialog and that add file's path in the ListBoxAnd when I click "Merge File" It merge all GIF file present in ListBox
And when I click "Split File" it split all GIF File present in a File Container and that It save GIF Files in the same directory of the File Container
I tried to write the code but it change any bytes of the GIF Files when I merge :( and i don't know how to use Split Function in VB.NET
[Off-Topic]I'm new in VB.NET and i don't know fine this new programming language
Best Regards Flash

[VB.NET] How to merge many GIF Files into one file
Awais786
Ben Amor Bassem
yes i mean directory. ;)
How do i do to merge many GIF Files into one file in VB.NET
Ash8Fee
kira2
Wyo
I didn't understand how to call Deserialize
Can you give me a complete example,please ;)
Thanks
JeffK_
durnurd
You mean something like a zip file where you can store many files into one and extract them afterwards
If so there's a free .NET zip component called SharpZip Lib:
http://www.icsharpcode.net/OpenSource/SharpZipLib/
You can use it to create zip files easily.
SOAC
Private Sub Save_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim sw As New IO.FileStream("c:\temp\archive.bin", IO.FileMode.Create)
Dim bmp As New Bitmap("c:\temp\test.bmp")
Dim fmt As New System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
fmt.Serialize(sw, bmp)
sw.Close()
End Sub
Private Sub Load_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
Dim sr As New IO.FileStream("c:\temp\archive.bin", IO.FileMode.Open)
Dim fmt As New System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
Dim bmp As Bitmap = CType(fmt.Deserialize(sr), Bitmap)
sr.Close()
PictureBox1.Image = CType(bmp, Image)
End Sub
Call the Serialize method for each image you want to save. Call the Deserialize method as long as sr.Position < sr.Length-1. Good luck.
Tomorrow Shi
No i want to create a file container with many GIF.
I dont' want to create a gif with many frame but i need merge many
laja
But if i have file's path to merge in a ListBox. How do i do
Imports
System.IOPublic
Class Form1 Private Sub btn_add_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btn_add.Click If OpenFileDialog1.ShowDialog = Windows.Forms.DialogResult.OK Then Dim S() As String = OpenFileDialog1.FileNames 'un array che contiene i nomi dei file scelti Dim File As String Dim sr As New IO.FileStream(OpenFileDialog1.FileName, IO.FileMode.Open) Dim fmt As New System.Runtime.Serialization.Formatters.Binary.BinaryFormatter For Each File In SListBox1.Items.Add(File)
Nextsr.Close()
End If End Sub Private Sub btn_create_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btn_create.Click If SaveFileDialog1.ShowDialog = Windows.Forms.DialogResult.OK Then Dim sw As New IO.FileStream(SaveFileDialog1.FileName, IO.FileMode.Create) Dim fmt As New System.Runtime.Serialization.Formatters.Binary.BinaryFormattersw.Close()
End If End SubEnd
ClassDaveskis
...
Dim sw As New IO.FileStream(SaveFileDialog1.FileName, IO.FileMode.Create)
Dim fmt As New System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
Dim bmp As Bitmap
For Each item As String In ListBox1.Items
bmp = CType(Bitmap.FromFile(item), Bitmap)
fmt.Serialize(sw, bmp)
Next
sw.Close()
End Sub
Naveenkm
danych
The code goes fine ^_^ but if i merge GIF File with a HEX Editor i see this string before GIF Merged i can add other lines of code after For Each ...Next and i read all text and i delete this string:
......................QSystem.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a......System.Drawing.Bitmap.....Data.................'...
How can i do
JHarjung
Thanks!!!!!!!!!!!!!!!!
But I have another problem, when i merge GIF Files into a file, my software add this text:
......................QSystem.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a......System.Drawing.Bitmap.....Data.................'...
I don't want that this text come added. How do i do