Click here to Skip to main content
15,077,898 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
How to convert the JPEG image to blob?
Posted
Comments
Sandeep Mewara 11-May-11 6:26am
   
Elaborate.
AspDotNetDev 11-May-11 19:28pm
   
Not sure, but this is how you convert blob to JPEG image: http://4.bp.blogspot.com/_W3bLkLDR-6o/TAkRCcm3J5I/AAAAAAAAHX8/zY0wa64j_AU/s1600/Copia+de+The_Blob_1988.jpg
Archit9373284448 12-May-11 3:23am
   
what was that?
AspDotNetDev 12-May-11 23:37pm
   
It's... the Blob!

your image (physical file is already a blob)...you can import this in the memory RAM

FileStram imgStream = File.OpenRead("C:\\photos\me.jpg");
byte[] blob = new byte[imgStream.Length];
imgStream.Read( blob, 0, (int)imgStream.Length);

imgStream.Dispose( );


Now blob array contains the binary view of your picture...
   
v2
Comments
Gokulnath007 12-May-11 8:59am
   
I have tried with this method, but only 4 symbols are there in it.
A jpeg encoded image is a BLOB, as is almost anything else.
   
Comments
Gokulnath007 11-May-11 6:43am
   
I need to get the JPEG image's binary bits so that it can be saved in to the blob field of the database.
Niklas L 11-May-11 6:46am
   
Don't you have a pointer to the jpeg image? That will be the BLOB.
Gokulnath007 11-May-11 6:56am
   
How to get the pointer for the JPEG image?
Niklas L 11-May-11 7:26am
   
Don't you have a jpeg image? Is it located on disk? If so read the entire file to a chunk of memory. There you have it. The BLOB.
Gokulnath007 12-May-11 8:59am
   
I have tried with this method, but only 4 symbols are there in it.
Niklas L 13-May-11 3:28am
   
What are you talking about? What symbols?
1: Where is your image?
2. What exactly is it that makes it hard to save it to the database?

Maybe you should update your question with a small code snippet, showing what you have done?

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)




CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900