Link to home
Start Free TrialLog in
Avatar of stanl
stanl

asked on

Extracting Bitmaps/Jpeg's/Gifs from Access

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
Avatar of drnick
drnick

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.
Avatar of stanl

ASKER

>>extract the bitmap like it
>>was an object in such a document.

which begs the question.  How?
ASKER CERTIFIED SOLUTION
Avatar of ankuratvb
ankuratvb
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Melih SARICA
First 4 bytes of every image has descrtiptor header..

like BMP. GIF. JFIF check these bytes

SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of stanl

ASKER

you can delete the question -