Click here to Skip to main content
15,890,043 members
Home / Discussions / C#
   

C#

 
AnswerRe: Sorting a collection of classes Pin
AFSEKI7-May-07 4:01
AFSEKI7-May-07 4:01 
QuestionC#, DWM, and Window Image Capture (Vista) Pin
surrealmadrid3-May-07 12:22
surrealmadrid3-May-07 12:22 
Questionimage to string and backwords.. Pin
Seishin#3-May-07 11:33
Seishin#3-May-07 11:33 
AnswerRe: image to string and backwords.. Pin
Luc Pattyn3-May-07 11:47
sitebuilderLuc Pattyn3-May-07 11:47 
GeneralRe: image to string and backwords.. Pin
Seishin#3-May-07 19:13
Seishin#3-May-07 19:13 
AnswerRe: image to string and backwords.. Pin
Stefan Prodan3-May-07 12:30
Stefan Prodan3-May-07 12:30 
GeneralRe: image to string and backwords.. Pin
Seishin#3-May-07 19:14
Seishin#3-May-07 19:14 
GeneralRe: image to string and backwords.. Pin
Stefan Prodan4-May-07 0:42
Stefan Prodan4-May-07 0:42 
Here is my code, I've test it with BMP but I think it will work with any image format.

<br />
using System.IO;<br />
using System.Drawing;<br />
using System.Runtime.Serialization.Formatters.Soap;<br />


<br />
Image image = Image.FromFile(file); // load some image<br />
SoapFormatter formater = new SoapFormatter();<br />
byte[] obj;<br />
using (MemoryStream ms = new MemoryStream())<br />
{<br />
    formater.Serialize(ms, image);<br />
    obj = ms.ToArray();<br />
}<br />
<br />
string str = Convert.ToBase64String(obj); // convert byte[] to string<br />
<br />
byte[] bytes = Convert.FromBase64String(str);// convert string to byte[]<br />
<br />
Image newImage;<br />
using (MemoryStream ms = new MemoryStream(bytes))<br />
{<br />
    newImage = (Image)formater.Deserialize(ms);<br />
}<br />
<br />
newImage.Save(file + ".bmp");<br />


http://stefanprodan.wordpress.com

AnswerRe: image to string and backwords.. Pin
AFSEKI7-May-07 4:08
AFSEKI7-May-07 4:08 
QuestionSuggestion for C# compatible language Pin
bfoo753-May-07 9:45
bfoo753-May-07 9:45 
AnswerRe: Suggestion for C# compatible language Pin
pbraun3-May-07 10:54
pbraun3-May-07 10:54 
AnswerRe: Suggestion for C# compatible language Pin
PIEBALDconsult3-May-07 11:51
mvePIEBALDconsult3-May-07 11:51 
GeneralRe: Suggestion for C# compatible language Pin
J4amieC3-May-07 22:02
J4amieC3-May-07 22:02 
AnswerRe: Suggestion for C# compatible language Pin
Stefan Prodan3-May-07 11:52
Stefan Prodan3-May-07 11:52 
AnswerRe: Suggestion for C# compatible language Pin
AFSEKI7-May-07 4:12
AFSEKI7-May-07 4:12 
QuestionArrays in C# Pin
LCI3-May-07 9:36
LCI3-May-07 9:36 
AnswerRe: Arrays in C# Pin
Jimmanuel3-May-07 9:41
Jimmanuel3-May-07 9:41 
GeneralRe: Arrays in C# Pin
LCI3-May-07 9:53
LCI3-May-07 9:53 
GeneralRe: Arrays in C# Pin
Jimmanuel3-May-07 10:08
Jimmanuel3-May-07 10:08 
GeneralRe: Arrays in C# Pin
Pualee3-May-07 10:36
Pualee3-May-07 10:36 
AnswerRe: Arrays in C# Pin
Guffa3-May-07 14:33
Guffa3-May-07 14:33 
GeneralRe: Arrays in C# Pin
mav.northwind3-May-07 18:47
mav.northwind3-May-07 18:47 
AnswerRe: Arrays in C# Pin
Guffa3-May-07 19:27
Guffa3-May-07 19:27 
GeneralRe: Arrays in C# Pin
mav.northwind4-May-07 8:12
mav.northwind4-May-07 8:12 
AnswerRe: Arrays in C# Pin
Guffa4-May-07 8:33
Guffa4-May-07 8:33 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.