Connecting Tech Pros Worldwide Forums | Help | Site Map

OLE IMages in Access DB

John Galt
Guest
 
Posts: n/a
#1: Nov 12 '05
I have a MDB (Access 2002) with OLE Objects in 1 column of a table.

The obj is a GIF. I want to extract the gif and put it in a file in a
directory on a network drive.

Can anyone help me understand how to code the VBA for this?

Thanks



Stephen Lebans
Guest
 
Posts: n/a
#2: Nov 12 '05

re: OLE IMages in Access DB


If you require a programmatic solution then I will assume you have too
many records to allow you to simply invoke the OLE server program that
inserted them originally and extract them one at a time.

If you can live with Jpeg or Bitmap files then there is a programmatic
solution here:
http://www.lebans.com/oletodisk.htm
A2KExportOLEtoJPEG.zip A2K ONLY! This version saves the entire
contents of a table containing OLE Object Images to disk based Jpeg
files. User selectable compression rate. Version 1.5

Further conversion to GIF format presents a problem. THe simplest
method would be to use a Paint/Draw program that supports batch
conversion such as Paint Shop Pro. If for whatever reason a code only
solution was required you could easily modify the PictureBoxToGif class
on my site to perform the conversion.
http://www.lebans.com/pictureboxtogif.htm
PictureBoxToGif.Zip is a class that allows the user to save the contents
of a PictureBox to a disk based Gif file. This is a standard Gif file
with compression so please read the Unisys document below. Full Gif
patent info is included in the ZIP file you will be downloading.

--

HTH
Stephen Lebans
http://www.lebans.com
Access Code, Tips and Tricks
Please respond only to the newsgroups so everyone can benefit.


"John Galt" <jsys@yahoo.com> wrote in message
news:i17Xb.21236$Bv6.3425133@news1.epix.net...[color=blue]
> I have a MDB (Access 2002) with OLE Objects in 1 column of a table.
>
> The obj is a GIF. I want to extract the gif and put it in a file in a
> directory on a network drive.
>
> Can anyone help me understand how to code the VBA for this?
>
> Thanks
>
>[/color]

Tony Toews
Guest
 
Posts: n/a
#3: Nov 12 '05

re: OLE IMages in Access DB


"Stephen Lebans" <ForEmailGotoMy.WebSite.-WWWdotlebansdotcom@linvalid.com> wrote:
[color=blue]
>If you require a programmatic solution then I will assume you have too
>many records to allow you to simply invoke the OLE server program that
>inserted them originally and extract them one at a time.
>
>If you can live with Jpeg or Bitmap files[/color]

But why? I mean why does the original post have to live with jpg or bmp files. In my
ignorance I would've thought that OLE Objects contain a bit of header information, ie
file path and name and then the data. Furthermore the data would be pretty much
exactly what it would look like on the hard drive.

Tony
--
Tony Toews, Microsoft Access MVP
Please respond only in the newsgroups so that others can
read the entire thread of messages.
Microsoft Access Links, Hints, Tips & Accounting Systems at
http://www.granite.ab.ca/accsmstr.htm
Larry Linson
Guest
 
Posts: n/a
#4: Nov 12 '05

re: OLE IMages in Access DB



"Tony Toews" <ttoews@telusplanet.net> wrote
[color=blue][color=green]
> >If you can live with Jpeg or Bitmap files[/color]
>
> But why? I mean why does the original post
> have to live with jpg or bmp files. In my
> ignorance I would've thought that OLE
> Objects contain a bit of header information,[/color]

Because Stephen didn't sign up to write a "general save an OLE Object to any
file form of your choosing" software package. That would be a pretty tall
order for someone doing some freebie software just to satisfy his own
interests, now wouldn't it?


Tony Toews
Guest
 
Posts: n/a
#5: Nov 12 '05

re: OLE IMages in Access DB


"Larry Linson" <bouncer@localhost.not> wrote:
[color=blue][color=green]
> > But why? I mean why does the original post
> > have to live with jpg or bmp files. In my
> > ignorance I would've thought that OLE
> > Objects contain a bit of header information,[/color]
>
>Because Stephen didn't sign up to write a "general save an OLE Object to any
>file form of your choosing" software package. That would be a pretty tall
>order for someone doing some freebie software just to satisfy his own
>interests, now wouldn't it?[/color]

Umm, yeah but ....

I'm only trying to understand why the format of the file saved in the OLE object in a
table is any different than the file format of the object in a file on the hard
drive.

Besides Stephen thrives an challenges. <smile>

Tony
--
Tony Toews, Microsoft Access MVP
Please respond only in the newsgroups so that others can
read the entire thread of messages.
Microsoft Access Links, Hints, Tips & Accounting Systems at
http://www.granite.ab.ca/accsmstr.htm
Stephen Lebans
Guest
 
Posts: n/a
#6: Nov 12 '05

re: OLE IMages in Access DB


Hey Tony,
it's been a long time but if I remember correctly, when the OLE Server
inserts the Image into the OLE object field it can do so in basically
any manner it wishes to. For those files that I have examined, and
depending on the original Image format, the OLE field can contain:
1) An uncompressed Bitmap(DIB) of the Image for display purposes.
2) An uncompressed Bitmap(DIB) of the Image wrappedn within an Enhanced
Metafile.
3) A binary copy of the original file.

The problem is that this is private data and therefore subject to the
designs of the OLE Server. Sometimes a copy of the original file is
present sometimes not.
When the solution on my site exports the contents of the OLE field it
simply asks for a copy of the uncompressed Bitmap to be placed onto the
ClipBoard. I then use the Intel JPG library to save this to disk.

By coincidence, I have spent the last 24 hours working with the
FreeImage library and hooking it up to a standard Access Image control.
It supports loading/saving to almost all of the popular raster Image
formats. I'll post the code to hookup the FreeImage DLL to an Image
control so a developer could then specify basically any raster format
they desire when using my OleExport routines.


--

HTH
Stephen Lebans
http://www.lebans.com
Access Code, Tips and Tricks
Please respond only to the newsgroups so everyone can benefit.


"Tony Toews" <ttoews@telusplanet.net> wrote in message
news:q6qq20lqvpjmhrhauuptp67i5aad7lr18r@4ax.com...[color=blue]
> "Larry Linson" <bouncer@localhost.not> wrote:
>[color=green][color=darkred]
> > > But why? I mean why does the original post
> > > have to live with jpg or bmp files. In my
> > > ignorance I would've thought that OLE
> > > Objects contain a bit of header information,[/color]
> >
> >Because Stephen didn't sign up to write a "general save an OLE Object[/color][/color]
to any[color=blue][color=green]
> >file form of your choosing" software package. That would be a pretty[/color][/color]
tall[color=blue][color=green]
> >order for someone doing some freebie software just to satisfy his own
> >interests, now wouldn't it?[/color]
>
> Umm, yeah but ....
>
> I'm only trying to understand why the format of the file saved in the[/color]
OLE object in a[color=blue]
> table is any different than the file format of the object in a file on[/color]
the hard[color=blue]
> drive.
>
> Besides Stephen thrives an challenges. <smile>
>
> Tony
> --
> Tony Toews, Microsoft Access MVP
> Please respond only in the newsgroups so that others can
> read the entire thread of messages.
> Microsoft Access Links, Hints, Tips & Accounting Systems at
> http://www.granite.ab.ca/accsmstr.htm[/color]

Tony Toews
Guest
 
Posts: n/a
#7: Nov 12 '05

re: OLE IMages in Access DB


"Stephen Lebans" <ForEmailGotoMy.WebSite.-WWWdotlebansdotcom@linvalid.com> wrote:
[color=blue]
>it's been a long time but if I remember correctly, when the OLE Server
>inserts the Image into the OLE object field it can do so in basically
>any manner it wishes to. For those files that I have examined, and
>depending on the original Image format, the OLE field can contain:
>1) An uncompressed Bitmap(DIB) of the Image for display purposes.
>2) An uncompressed Bitmap(DIB) of the Image wrappedn within an Enhanced
>Metafile.
>3) A binary copy of the original file.[/color]

I was thinking after my previous posting that there had to be the internal version of
the file as well. This being the version that we complain about bloating the Access
MDB so much.
[color=blue]
>The problem is that this is private data and therefore subject to the
>designs of the OLE Server. Sometimes a copy of the original file is
>present sometimes not.[/color]

Ah. I would've thought that somehow, there would be several different "sub objects"
easily figured out via API calls so you can just extract what you wanted.
[color=blue]
>When the solution on my site exports the contents of the OLE field it
>simply asks for a copy of the uncompressed Bitmap to be placed onto the
>ClipBoard. I then use the Intel JPG library to save this to disk.[/color]

I had figured that much out by looking at your MDB last week. But I was wondering
why all this was necessary. As per my original question. Now I have a better idea.
[color=blue]
>By coincidence, I have spent the last 24 hours working with the
>FreeImage library and hooking it up to a standard Access Image control.
>It supports loading/saving to almost all of the popular raster Image
>formats. I'll post the code to hookup the FreeImage DLL to an Image
>control so a developer could then specify basically any raster format
>they desire when using my OleExport routines.[/color]

Fabulous. Very fabulous.

Tony
--
Tony Toews, Microsoft Access MVP
Please respond only in the newsgroups so that others can
read the entire thread of messages.
Microsoft Access Links, Hints, Tips & Accounting Systems at
http://www.granite.ab.ca/accsmstr.htm
Closed Thread