Click here to Skip to main content
12,396,144 members (62,074 online)
Rate this:
 
Please Sign up or sign in to vote.
See more: VC8.0 C++
How to convert the JPEG image to blob?
Posted 11-May-11 0:02am
Comments
S 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!
Rate this: bad
 
good
Please Sign up or sign in to vote.

Solution 2

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...
  Permalink  
v2
Comments
Gokulnath007 12-May-11 8:59am
   
I have tried with this method, but only 4 symbols are there in it.
Rate this: bad
 
good
Please Sign up or sign in to vote.

Solution 1

A jpeg encoded image is a BLOB, as is almost anything else.
  Permalink  
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 Lindquist 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 Lindquist 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 Lindquist 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)

  Print Answers RSS
Top Experts
Last 24hrsThis month


Advertise | Privacy | Mobile
Web02 | 2.8.160721.1 | Last Updated 11 May 2011
Copyright © CodeProject, 1999-2016
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100