By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
445,705 Members | 1,777 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 445,705 IT Pros & Developers. It's quick & easy.

OLE IMages in Access DB

P: n/a
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
Nov 12 '05 #1
Share this Question
Share on Google+
6 Replies


P: n/a
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" <js**@yahoo.com> wrote in message
news:i1*********************@news1.epix.net...
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


Nov 12 '05 #2

P: n/a
"Stephen Lebans" <Fo****************************************@linval id.com> wrote:
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


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
Nov 12 '05 #3

P: n/a

"Tony Toews" <tt****@telusplanet.net> wrote
If you can live with Jpeg or Bitmap files


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,


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?
Nov 12 '05 #4

P: n/a
"Larry Linson" <bo*****@localhost.not> wrote:
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,


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?


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
Nov 12 '05 #5

P: n/a
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" <tt****@telusplanet.net> wrote in message
news:q6********************************@4ax.com...
"Larry Linson" <bo*****@localhost.not> wrote:
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,
Because Stephen didn't sign up to write a "general save an OLE Object to anyfile form of your choosing" software package. That would be a pretty tallorder for someone doing some freebie software just to satisfy his own
interests, now wouldn't it?


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


Nov 12 '05 #6

P: n/a
"Stephen Lebans" <Fo****************************************@linval id.com> wrote:
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.
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.
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.
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.
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.
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.
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.


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
Nov 12 '05 #7

This discussion thread is closed

Replies have been disabled for this discussion.