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.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
Mahendran SubramanianPosted Nov 30, 2007, 6:39 AM
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
RakrusPosted Nov 27, 2007, 5:28 AM
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 SubramanianPosted Nov 21, 2007, 8:23 AM
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.
deben bhattaraiPosted Nov 21, 2007, 4:53 AM
copy the content of text file and then pact it into a paint editor(ex. MSpaint)
and save as .bmp / .jpeg etc.