AJR 2004; 182:1591-1596
© American Roentgen Ray Society
A Simple Method for Importing Multiple Image Files into PowerPoint
Chris Sistrom1 and
Janice Honeyman-Buck
1 Both authors: Department of Radiology, University of Florida, PO Box 100374,
Gainesville, FL 32610.
Received October 23, 2003;
accepted after revision November 20, 2003.
Address correspondence to C. Sistrom.
C. Sistrom received funding from a General Electric Association of
University Radiologists Research Fellowship from July 2000 through June
2003.
Abstract
OBJECTIVE. We developed a method for automatically inserting a large
number of images into a PowerPoint presentation document.
CONCLUSION. We designed, tested, and now routinely use a simple
macro program for importing all images contained in a single directory into a
PowerPoint presentation. The complete text of the macro code is included in
this article, and readers are encouraged to experiment with it.
Introduction
Several authors have recently described techniques for acquiring,
optimizing, and storing radiologic images for teaching and publication using
PCs and common software
[18].
Once they are finished, such images are often incorporated into slide
presentation software programs, of which the most ubiquitous is Microsoft's
PowerPoint program, a part of their Office Suite. The process of bringing
images into PowerPoint and preparing the resulting presentations for effective
teaching has been described in detail
[913].
Importing the picture files into a presentation can take a considerable amount
of time, especially when many images are required. Another time-consuming task
is scaling and centering the images once they have been added to slides.
Scaling is particularly troublesome when the image is larger than the
slide.
We have developed a short program using the Visual Basic for Applications
language that takes advantage of the macro functionality built into all
Microsoft Office products. Our program automates the process of importing
multiple images into a PowerPoint presentation. The only prerequisites are
that the image files be in one of several standard formats and that they
reside in a single directory. During the import process, each image is
optimally centered and scaled on a separate slide. In this article, we briefly
describe the function and use of the macro program and also give a complete
listing of it so that readers can use it themselves. The software is also
available for download from a Web site.
How the Macro Works
Once activated, the macro requests a directory location from the user. It
then searches through the entire directory and obtains the name the files.
Each file is tested to determine if it contains an image in one of five common
formats, using the three-letter file extension as its criterion. The five
formats include tagged image file format (.tif), PC paintbrush (.pcx),
bit-mapped graphics format (.bmp), .gif, and .jpg. If a file has one of these
extensions, the image it contains is placed on a new slide and added to the
presentation.
Before moving to the next file, the program code centers and sizes the
image to make it as large as possible and still fit on the slide. Large images
are scaled down and small images are scaled up as needed. PowerPoint stores
variables representing the width, height, and absolute position for all shapes
(including images) in each slide, which makes it easy to compute appropriate
scale and position factors and apply them to the image. These calculations
preserve the height-to-width relationshipthe aspect ratioof the
original image. When the process is finished, a dialogue box is displayed
listing the total number of files and the number of images imported.
Installing the Macro into Your PowerPoint Presentation
We have included the entire macro as Appendix I of this article. To keep it
as compact as possible, we have removed comment lines and show only the
program itself. To obtain an electronic copy of the code, go to the
AJR web site and look up the full text of this article. Scroll down
to Appendix I and copy the text that appears between the dashed lines. Do this
by highlighting the text with your mouse and clicking Edit > Copy.
Next, open Microsoft PowerPoint and select Tools > Macro >
Macros. In the top of the resulting dialogue box, type the name of the macro
(Fig. 1). We used the name
"Getpix." Then click on "Create" and another window
will open (Fig. 2). This is the
Visual Basic Editor. You should see the following text in the editing
window:
Sub Getpix()
Macro created mm/dd/yyyy by xxx zzzz
End Sub,
where mm/dd/yyyy is the current date and xxx zzzz is the user's name. If a
different name for the macro was used, it will show up in the first line
instead of "Getpix." The macro text (copied from Appendix I of the
online article) should be pasted in the blank line above "End
Sub." Then select File > Close and return to Microsoft
PowerPoint. Before importing any images or creating other slides, select File
> Save As and save a blank presentation containing the macro for
future use in one of your folders.
Using the Macro
Once the macro has been created in a PowerPoint presentation file, using it
is fairly simple. Select Tools > Macro > Macros, and
highlight the name of the macro (e.g., Getpix as in
Fig. 3). After the
"Run" button is clicked, the macro activates and displays a
dialogue box that asks for the location of the directory containing the images
to be imported. Type the directory path (C:/Temp/Pix1/) in our example and
click the "OK" button (Fig.
4). The macro imports all the images into the chosen directory,
places each one on a separate slide, and centers and scales them to fit. The
slides are ordered in an alphabetic sequence that is based on the file names
of the source images. A completion dialogue box
(Fig. 5) gives results of the
operation and displays the source directory, the total number of files, and
the number of slides created. The macro may be executed again, and additional
images will be added to the end of the presentation.

View larger version (23K):
[in this window]
[in a new window]
[as a PowerPoint slide]
|
Fig. 4. Prompt displayed by PowerPoint (Microsoft) macro at run time
asks for path to image source directory. Name and path (C:/Temp/Pix1/) have
already been typed. Program will activate when "Run" is
clicked.
|
|

View larger version (32K):
[in this window]
[in a new window]
[as a PowerPoint slide]
|
Fig. 5. Prompt displayed by PowerPoint (Microsoft) macro after
completion lists source directory, total number of files, and number of slides
created. Presentation may be edited after "OK" is clicked.
|
|
One convenient way to use the program is to create and save a blank
PowerPoint presentation file (e.g., call it "Blank.ppt") that
contains the macro. Set up the master slide template in this blank
presentation to reflect your individual preferences for slide background and
text properties. To start a new working presentation, simply open Blank.ppt
and run the macro. Before importing the images, select File > Save
As and specify a new location and name for your presentation. After you click
"Save," the file name at the top of the PowerPoint window will
change to reflect the newly chosen name. The blank presentation will remain
unchanged and ready for the next session.
Presentations can be edited to add text slides between image slides.
Deleting the Macro
A minor drawback of using macros in PowerPoint presentations is that when
they are opened, an extra dialogue box may appear
(Fig. 6). It warns that macros
can sometimes be harmful and offers to disable them. Some particularly
conservative antivirus programs may identify a presentation containing a macro
as being potentially compromised. The best way to avoid this message is to
delete the macro from your working presentation after all the images have been
imported. To do this, select Tools > Macro > Macros and
highlight the name of the macro (e.g., Getpix in our example). Then click
"Edit" and a new window will open. The upper left corner will show
a sub window called "ProjectVBAProject"
(Fig. 7). Highlight
"Module1," right click, and select "Remove Module1."
Answer "No" to the dialogue box that appears, and the macro will
be removed. Next, select File > Close and return to Microsoft
PowerPoint. If the presentation is saved at this point and then reopened, it
will activate and display the slides without the initial warning dialogue
box.

View larger version (34K):
[in this window]
[in a new window]
[as a PowerPoint slide]
|
Fig. 6. When file containing macro is opened, PowerPoint (Microsoft)
may display dialogue box that warns about possible harmful effects and offers
to disable any macros in file. For our macro to work, "Enable
Macros" must be clicked.
|
|

View larger version (55K):
[in this window]
[in a new window]
[as a PowerPoint slide]
|
Fig. 7. Window displayed after clicking on "Edit" in
PowerPoint (Microsoft) macro dialogue box
(Fig. 3). To remove code from
current presentation, highlight line called "Module1"
(arrows), right click with mouse, and select "Remove
Module1" from resulting pick list. Answer "No" to subsequent
dialogue box that offers to save module.
|
|
Alternate Solutions
In his article titled Getting Images into PowerPoint, Schreibman
[12] briefly notes an
enhancement for PowerPoint 2000 that is available from Microsoft. We accessed
the Web site listed in the article text
[14] and downloaded and
installed the program (a photo album add-in for PowerPoint). We used the
software to import the same set of images we had previously used to test our
macro. The "Fit To Slide" option was chosen. The resulting
PowerPoint presentation was identical to one created by our macro in every
respect. Readers are encouraged to experiment with the Microsoft photo album
solution. It has a graphic interface to browse for image files, allows preview
of images, and permits selection of individual images. However, the photo
album addin is specific to the Office 2000 version of PowerPoint. Also, the
photo album feature is an extension to the PowerPoint program itself and must
be installed on each computer before it is used. Our macro does not require
installing any new software and is "portable" in the sense that a
blank presentation file containing the code can be copied to any computer, and
the image import function will be immediately available. We have confirmed
that the macro functions identically on numerous computers running the Windows
97, Windows 2000, Windows XP, and Macintosh versions of PowerPoint.
One group has developed a teaching file system with Microsoft Visual C++
and a Visual FoxPro database
[15]. This system uses
programming techniques similar to those in our macro to "inject"
multiple images from the teaching file into a PowerPoint presentation. These
authors also stressed that this feature would save considerable time over the
conventional method of inserting images onto individual slides in a
presentation. The concept of complete integration of a teaching file database
with presentation software is powerful, and we are working toward this with
our own departmental electronic teaching file system. In the meantime, our
approach offers a method for at least partial automation of the process that
should be useful to all readers.
Troubleshooting
The most obvious source of problems will be any errors made while creating
the macro. The macro is a computer program and must be entered or copied
accurately in exactly the correct sequence. If the macro is entered
incorrectly, a variety of error messages may result when it is run. For the
code to function correctly, the Microsoft Office installation must have
included all the relevant image import filters. These filters are common to
the whole suite of Microsoft Office programs and will be present if the
"typical" configuration option was chosen during the initial
Office installation.
The default security behavior of PowerPoint pertaining to macros has
already been mentioned: The "Medium" security setting causes
display of a warning dialogue box at startup
(Fig. 6) when the presentation
contains a user-defined macro. With "High" security, PowerPoint
opens a macro-containing presentation without any warning dialogue box.
However, if Tools > Macro > Macros is selected, the
"Run" button will be inoperable. To correct this, click Tools
> Macro > Security and select the "Medium"
setting. After you exit and restart PowerPoint, answer "Enable
Macros" in the warning dialogue box and proceed to use the macro.
If your current Microsoft Office software does not include one or more of
the graphics import filters, PowerPoint may attempt to automatically install
the relevant filter when the macro encounters an unrecognized image type. A
dialogue box will appear indicating the need for a filter, and the user may be
prompted to insert the original program disk (usually a CD-ROM). Updating the
Microsoft Office installation manually may require running the Office setup
program again. In newer versions of Windows (98 or later), this operation is
performed through the "Control Panel" and its "Add/Remove
Programs" function. Older versions of Windows may require inserting an
Office installation CD-ROM and running setup from the CD-ROM. After activating
the setup program, select the "Add/Remove Features" option, select
Converters And Filters > Graphics Filters, and make sure that all
the relevant graphics import filters (labeled BMP, JPEG, PCX, GIF, and TIF)
are active by verifying that they have a check mark next to them. Then follow
the onscreen directions to update the installation.
One more potential barrier to proper functioning of our macro is somewhat
esoteric. The macro draws on "references," which are ancillary
files included in most standard Microsoft Office installations. They are
external to the main PowerPoint program and are needed to enable the functions
coded in macros. We experimented with various versions of PowerPoint and found
that three references must be active: Visual Basic for Applications, Microsoft
PowerPoint X.Y Object Library, and Microsoft Office X.Y Object Library. X.Y is
the current version of the Microsoft software your computer is running. For
example, X.Y = 9.0 at our installation, but it may be different for other
computer systems.
To look at the references, open a presentation containing the macro and
select Tools > Macro > Macros, highlight the macro name,
and click "Edit." When the Visual Basic Editor window opens,
select Tools > References, and the dialogue box shown in
Figure 8 should be displayed.
One can scroll down through the list and click the boxes next to the relevant
entries if they are not already checked. Be careful about clearing the checks
from any other boxes because they may be providing functionality needed for
other features that your particular Office installation is using.

View larger version (48K):
[in this window]
[in a new window]
[as a PowerPoint slide]
|
Fig. 8. Dialogue box displayed after selecting Tools >
References from Visual Basic window (Fig.
7) during macro editing shows that three required objects (Visual
Basic for Applications, Microsoft PowerPoint 9.0 Object Library, and Office
9.0 Object Library) are checked, which indicates that they are active. Version
number for Microsoft Office (here, version 9.0) will vary depending on your
software.
|
|
Limitations
Our program lacks the ability to add multiple images to a single slide.
This feature is not needed for most purposes. In fact, crowding multiple
images onto one slide may make it much harder for the audience to see the
radiologic findings. Some may believe that putting multiple images on each
slide would reduce the file size of the resulting presentation. This is not
the case because imported images are kept in their entirety with scaling tags
that are added to cause them to be displayed as specified. We find it
preferable to make the points about cases and findings in our text slides and
then illustrate the points with full-sized images augmented with annotations
such as arrows.
Multiple images can be placed on a single slide during the editing of the
presentation content after the images have been imported. The macro code can
also be modified to scale images to one half or one quarter the size of a
slide, which would make it easy to show several images at once. One of the
reasons that we are including the full code of the macro is to encourage
readers to modify it to suit their individual needs.
The method of specifying the image input directory is rudimentary and does
not use the graphic file selection methods available in Windows. The user must
accurately type the complete path to the image file directory. Also, we have
not provided an option to preview or select individual images for the import
directory. These features could have been written into our macro. However, the
code would have been much longer, more complex, and version-specific. We
decided to keep the program simple to reduce the possibility of errors. More
functionality requires additional customization of the PowerPoint
installation. Users may already face challenges in getting the existing code
to work properly on their particular computers.
Conclusion
Appendix I contains the complete text of the macro. Detailed instructions
are provided in the text for copying the code from the online version of this
document on the AJR Web site and installing it in a blank PowerPoint
presentation.
We have described how to use the macro and given troubleshooting advice for
common problems that might arise. We have also placed blank PowerPoint
presentation files with the macro already installed on an Internet server
[16] for any interested
readers to download. To obtain them, simply browse to where you will find
download links for the macro text and blank presentation files in formats for
various versions of PowerPoint. We hope that interested readers will use the
program, modify it as needed, and pass it on to their colleagues.
References
- Caruso RD, Postel GC. Image editing with Adobe Photoshop 6.0.
RadioGraphics2002; 22:993
1002[Abstract/Free Full Text]
- Caruso RD, Postel GC. Image annotation with Adobe Photoshop.
J Digit Imaging2002; 15:197
202[Medline]
- Corl FM, Garland MR, Lawler LP, Fishman EK. A five-step approach to
digital image manipulation for the radiologist.
RadioGraphics2002; 22:981
992[Abstract/Free Full Text]
- Taylor GA. Initial steps in image preparation.
AJR 2002;179:1411
1413[Free Full Text]
- Taylor GA. Removal of dust and scratches from electronic image
files. AJR2003; 180:1533
1536[Free Full Text]
- Taylor GA. Sharpening the image. AJR2003; 181:43
45[Free Full Text]
- Taylor GA. Color correction and automating repetitive tasks.
AJR 2003;181:383
386[Free Full Text]
- Taylor GA. Improving image contrast. AJR2003; 180:329
331[Free Full Text]
- Daffner RH. On improvement of scientific presentations: using
PowerPoint. AJR2003; 181:47
49[Free Full Text]
- Dreyer KJ. Using Microsoft PowerPoint for electronic presentations.
RadioGraphics2001; 21:1318
1321[Free Full Text]
- Schreibman KL. Hello, and two great tricks.
AJR 2001;177:1017
1018[Free Full Text]
- Schreibman KL. Getting images into PowerPoint.
AJR 2001;177:1271
1272[Free Full Text]
- Willing SJ. Getting images into PowerPoint.
AJR 2002;179:533
534[Free Full Text]
- Microsoft Download Center. Microsoft Web site. Available at:
http://office.microsoft.com/downloads/2000/album.aspx.
Accessed March 19, 2004
- Frank MS, Schultz T, Dreyer K. Integrating digital teaching-file
systems with off-the-shelf presentation software to facilitate speaker-led
conferences. J Digit Imaging2001; 14[suppl 1]:98
101[Medline]
- Author's Web site. Avialable at:
http://xray.ufl.edu/sistrom

CiteULike
Complore
Connotea
Del.icio.us
Digg
Reddit
Technorati What's this?
This article has been cited by other articles:

|
 |

|
 |
 
C.-S. Yam, J. Kruskal, and M. Larson
Creating Animated GIF Files for Electronic Presentations Using Photoshop
Am. J. Roentgenol.,
May 1, 2007;
188(5):
W485 - W490.
[Abstract]
[Full Text]
[PDF]
|
 |
|

|
 |

|
 |
 
C.-S. Yam
Simple Method for Inserting Flash Movies into PowerPoint Presentations
Am. J. Roentgenol.,
April 1, 2007;
188(4):
W374 - W378.
[Abstract]
[Full Text]
[PDF]
|
 |
|

|
 |

|
 |
 
T. J. Gniadek and B. Desjardins
Interactive Display of Stacks of Images in Scientific Presentations with PowerPoint
Am. J. Roentgenol.,
September 1, 2004;
183(3):
859 - 861.
[Abstract]
[Full Text]
[PDF]
|
 |
|