Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Publisher / Programming / February 2008

Tip: Looking for answers? Try searching our database.

Extract images from Publisher file

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Ildhund - 06 Feb 2008 12:50 GMT
I have inherited a picture archive from the previous editor of a local
newspaper. This archive takes the form of several large Publisher 2003 files
each with hundreds of images. Each image is, I think, grouped with a text
box containing a caption. Some of these captions are quite wordy. The
pictures are probably all jpgs, placed at full size and then resized in
Publisher to fit the space available.

I would like to produce a macro that would extract each picture as a
separate file, something like
(a) open a specified Publisher file in a particular folder
(b) create a new folder with the same name as the Publisher file
(c) find each instance of an image grouped with a text box
(d) ungroup the two objects
(e) select the first, say, 25 characters of the text in the text box having
converted any line breaks to spaces
(f) reset the image to 100%
(g) save the image as .jpg with (e) as its file name in folder (b)
(h) regroup the objects
(i) close the file without saving changes.

I can manage some of this, but I can't find either Reset to 100% or a Save
As Picture method for a shape object like there is in the UI. Am I
attempting the impossible? If so, can anyone suggest a method of extracting
these images?

I'm using Office 2003 on XPSP2.
Signature

Noel

Ed Bennett - 06 Feb 2008 13:08 GMT
> I can manage some of this, but I can't find either Reset to 100% or a Save
> As Picture method for a shape object like there is in the UI. Am I
> attempting the impossible? If so, can anyone suggest a method of extracting
> these images?

It is possible, but not directly - you have to be tricky. The
PictureFormat object has an EffectiveResolution property; scale the
picture by 300 / EffectiveResolution and then export at 300dpi and you
will get the image at roughly its original resolution.

To save as a picture, copy and paste the image into a new publication,
change the page setup so that it fits the image snugly, and set the
image to be at (0, 0). Then Page.SaveAsPicture. Recompression will
occur, annoyingly, but there's not much that can be done about that
(unless you can learn the Publisher file format enough that you can hack
the images directly out of the files).

Signature

Ed Bennett - MVP Microsoft Publisher
http://ed.mvps.org

Ildhund - 06 Feb 2008 22:12 GMT
Ed Bennett wrote...
>> can anyone suggest a method of extracting images?

> It is possible, but not directly - you have to be tricky. The
> PictureFormat object has an EffectiveResolution property; scale the
[quoted text clipped - 7 lines]
> can learn the Publisher file format enough that you can hack the images
> directly out of the files).

Thanks, Ed. I'll give it a go, but be prepared for further silly questions
when I get stuck ;)
Does the source document have to be open for code to work on it?
Signature

Noel

Ed Bennett - 06 Feb 2008 23:14 GMT
> Thanks, Ed. I'll give it a go, but be prepared for further silly questions
> when I get stuck ;)
> Does the source document have to be open for code to work on it?

If you're running a macro within the document, yes. If you're driving it
externally, then it has to be opened by the code you're running.

Signature

Ed Bennett - MVP Microsoft Publisher
http://ed.mvps.org

Ildhund - 07 Feb 2008 07:41 GMT
Ed Bennett wrote...

>> Does the source document have to be open for code to work on it?
>
> If you're running a macro within the document, yes. If you're driving it
> externally, then it has to be opened by the code you're running.

Thanks.
Signature

Noel


Rate this thread:






 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.