Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 SQL Server Development (2000)
 Extracting Images of Unknown Format

Author  Topic 

mcampster
Starting Member

1 Post

Posted - 2004-11-05 : 08:16:12
I am trying to extract all the images from a table, stored as type 'image' into files. I have looked at literally hundreds of similar issues, but have found none that solve my problem.

I have a table with a number of records containing an image column. Unfortunately, I do not know how the image was added to this table, or what it's original format was, however it is likely to be jpg or bmp. I am told that they may have been added to the table using an access form, with an image control on it, then using the insert object from file to associate the object to the file itself. How it has got from this MS Access object into the SQL table is what I don't know - and hopefully don't need to know!

My aim is to get all of the images out of the SQL 2000 table, and save them as files on the hard drive. Then I can associate the record with the image, rather than have it stored in the database as a blob.

I have been using ADO 2.6 to get a record set containing the data, and then writing the particular field to a Stream. This appears to work fine. On saving that stream to file, a file is created, but when trying to access this file, the format is unknown.

Does anyone know if I am fightig a lsing battle, or if I am just missing something.

Thanks

Mark

robvolk
Most Valuable Yak

15732 Posts

Posted - 2004-11-05 : 08:27:00
quote:
My aim is to get all of the images out of the SQL 2000 table, and save them as files on the hard drive. Then I can associate the record with the image, rather than have it stored in the database as a blob.
THANK YOU THANK YOU THANK YOU!!!!

There are a couple of links in this thread that describe various image formats:

http://www.sqlteam.com/forums/topic.asp?TOPIC_ID=42031

You should be able to inspect the first few bytes to determine the file format. JPEG's are pretty easy to identify.
Go to Top of Page
   

- Advertisement -