Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Extracting Bitmaps/Jpeg's/Gifs from Access

Posted on 2004-04-20
10
Medium Priority
?
717 Views
Last Modified: 2012-08-13
I have no problem using an ADO stream to insert small images into an Access table. These are not 'viewable' in Access, but can be streamed out with ADO, again no problem.  However, if I or (a user) manually inserts, say a BitMap, when written out to a file with ADO stream, a small 'header' is included which then makes the image unviewable.

; normal BMP file
424D0E28 00000000 00003600 00002800  BM·(······6···(·
00004200 00003300 00000100 18000000  ··B···3·········
0000D827 00000000 00000000 00000000  ··Ø'············
00000000 0000CC99 CCCCCCCC CCCCCCCC  ······Ì™ÌÌÌÌÌÌÌÌ

;  when manually input and streamed out from Access
151C2F00 02000000 0D000E00 14002100  ··/···········!·
FFFFFFFF 4269746D 61702049 6D616765  ÿÿÿÿBitmap Image
00506169 6E742E50 69637475 72650001  ·Paint.Picture··
05000002 00000007 00000050 42727573  ···········PBrus
68000000 00000000 00002028 0000424D  h········· (··BM
0E280000 00000000 36000000 28000000  ·(······6···(···
42000000 33000000 01001800 00000000  B···3···········

Is there anyway I can detect this header for all types of images, and if so are there any rules for stripping it off prior to writing the image out to a file? [I assume I could look for 424D as the first byte to denote a BMP, but that wouldn't work for a gif]

stan
0
Comment
Question by:stanl
  • 2
  • 2
  • 2
  • +2
10 Comments
 
LVL 5

Expert Comment

by:drnick
ID: 10875547
ok, guessing, no idea, could be rubbish:

can it be that you stored the image as an ole object?
in that case, the class name (Bitmap.Image?) and CLSI would be stored in the stream too.
the stream looks somehow like it was a compound document.
then, you may have to treat it like a compound document and extract the bitmap like it
was an object in such a document.
0
 

Author Comment

by:stanl
ID: 10876484
>>extract the bitmap like it
>>was an object in such a document.

which begs the question.  How?
0
 
LVL 9

Accepted Solution

by:
ankuratvb earned 500 total points
ID: 10877917
Why dont you just insert the path of the images instead of the images?

I know this has its own complications with respect to distribution of the database.
but having worked with Access and suffered quite a lot,i'd never insert images into an access database which would make it bloat even more.

Access is renowned for corrupting quite frequently.Storing the paths would reduce the size of your database to quite an extent as well.
0
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 
LVL 14

Assisted Solution

by:wayside
wayside earned 500 total points
ID: 10878521
Every image type has some sort of magic bytes at the beginning to identify it:

bitmap -> BM
.gif -> GIF

etc. Maybe search for those to find the beginning.

Or maybe the bits of the image always start at the 78th byte as they do in the example you posted, do a little experimenting with different image types to see if that is the case.
0
 
LVL 5

Assisted Solution

by:drnick
drnick earned 500 total points
ID: 10881529
also a good idea.

to mine proposal:
 if i was right, you have it to do with a stream or storage.
 if so, you can store everything in a file, like you did,
 but then, try to open it with
  StgOpenStorage or StgOpenStorageEx.
if that works, you could use OpenStream to get the stream,
however, you've to guess the streams name.
0
 
LVL 19

Expert Comment

by:Melih SARICA
ID: 10887860
First 4 bytes of every image has descrtiptor header..

like BMP. GIF. JFIF check these bytes

0
 
LVL 19

Assisted Solution

by:Melih SARICA
Melih SARICA earned 500 total points
ID: 10887876
and check this link for all formats

www.wotsit.org
0
 

Author Comment

by:stanl
ID: 11080571
you can delete the question -
0

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Windows Script Host (WSH) has been part of Windows since Windows NT4. Windows Script Host provides architecture for building dynamic scripts that consist of a core object model, scripting hosts, and scripting engines. The key components of Window…
Go is an acronym of golang, is a programming language developed Google in 2007. Go is a new language that is mostly in the C family, with significant input from Pascal/Modula/Oberon family. Hence Go arisen as low-level language with fast compilation…
This tutorial explains how to use the VisualVM tool for the Java platform application. This video goes into detail on the Threads, Sampler, and Profiler tabs.
Viewers will learn how to properly install Eclipse with the necessary JDK, and will take a look at an introductory Java program. Download Eclipse installation zip file: Extract files from zip file: Download and install JDK 8: Open Eclipse and …
Suggested Courses

927 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question