Hi Everyone,
i need to convert a text file to image file(*.Bmp,*.jpg).. Plz let me konw.. it's very urgent..
Regards,
Mahendran
Hi Everyone,
i need to convert a text file to image file(*.Bmp,*.jpg).. Plz let me konw.. it's very urgent..
Regards,
Mahendran
Know the answer? Post it. Somebody with the same question will find it here.
Answer a question in the forums and earn +20 SHARP for every answer.
See unanswered questions
DevSocialUpcoming · 3rd editionAI Agents ConferenceDec 1–3, 2026Live onlineFree to attend4days leftRegister
deben bhattarai2 reputationPosted Nov 20, 2007, 11:53 PM EST
copy the content of text file and then pact it into a paint editor(ex. MSpaint)
and save as .bmp / .jpeg etc.
Mahendran Subramanian15 reputationPosted Nov 21, 2007, 3:23 AM EST
Im Mahendran.. Thank you so much for ur reply... what i need to do is i want to make a thumbnail for word and text file in ASP.Net using C# programatically.. So i decided to convert the files into image file then we can easily make the thumbnail in ASp.net... If it is possible in .Net plz let me know.. Thnx in advance..
Regards,
Mahendran.
Rakrus106 reputationPosted Nov 27, 2007, 12:28 AM EST
Hi ,
Can you try this
If suppose the text file is selectd by using input file control
int len = Upload.PostedFile.ContentLength;
byte[] pic = new byte[len];
Upload.PostedFile.InputStream.Read (pic, 0, len);
MemoryStream stream = new MemoryStream ();
stream.Write (pic, 0, pic.Length);
Bitmap bitmap = new Bitmap (stream);
Response.ContentType = "image/gif";
bitmap.Save (Response.OutputStream, ImageFormat.Gif);
Thanks
Rakesh
Mahendran Subramanian15 reputationPosted Nov 30, 2007, 1:39 AM EST
Hi Rakrus,
I tried the same but i could'nt pass the stream value into Bitmap.. I got an error like "Parameter is not valid"
Error line:
BitMap image = new BitMap(stream); // Error: Parameter is not valid
Is there any other way.. If it's let me Know..
Thanks
Regards,
Mahesh