An important part of the design of Portable Presenter is the requirement for screen-size independency; fonts and also images are scaled, dependent on the actual screen-size.

There are two packages which handle images which you can use:

  • Tk::Photo images, which are part of tk, but only support a view formats and rather primitive operations;
  • Image::Magick images, which is a package available for many operating-systems, capable of processing hardly any image format imaginable.
    See the download page on how to retrieve this optional package.

They way how images work do differ on which package you use: Tk::Photo images are related to a canvas (say viewport), while Image::Magick images are device independent.

General Image Options

-file => filename
The name of the file to be used. PPresenter searches the directories in the imageDirs list (see the addImageDir function described below) for the file, except when this is an absolute path, of course.

Each file is read only once. Each images is scaled at most once per viewport which shows the image.

-sizeBase => geometry
Overrules what the show's -imageSizeBase is defining on what screen-size this image is made. During the presentation, the image is scaled to occupy the same amount of screen-space. Of course only when resizing is enabled.

-resize => boolean
Overrules the show's -resize (by default on), on whether the images should be resized or not. Resizing can only take place when a sizeBase is defined.

-enlarge => boolean
Overrules the show's -enlarge (by default off), on whether enlarging is allowed when resizing. This is usually not a good idea, because your image quality will be decrease.

imageDirs => [ dir, ... ]
Directories where images can reside. You shall not change anything directly in this list, but only using the function:
$show->addImageDir(dir, ...);
PPresenter searches all directories from @INC to find the directories you specified, and adds them in from of the list in imageDirs.

At start, the paths "PPresenter/images" and "." are added.

Related Options

Related options of show new():
-imageSizeBase => geometry
-resizeImages => boolean
-enlargeImages => boolean
-scaledImagesDir => dirname
Related options of decoration:
Determines the color to be used in anti-aliasing while resizing transparent images.


Example 1: Use in the Markup Formatter

A way to include an image in a show:
   use PPresenter;
   my $show = PPresenter->new;
   $show->addSlide(-template => 'main'
     , -main => '<IMG SRC=image.gif>');
Options to the IMG tag of the markup-formatter are RESIZE (reflects -resize), ENLARGE (-enlarge), BASE (-sizeBase), and some more for markup.

If the package Image::Magick is installed, then PPresenter will resize the image with ImageMagick. In that case, nearly all imaginable image formats can be used. If the package is not installed, the image is read via Tk::Photo, which supports only a small set of formats (see manual on Tk::Photo).

Example 2: Same image twice

If you use the same image for the second time in the same show, those specified options will be neglected: the first use is defining the image.
   use PPresenter;
   my $show = PPresenter->new;
   $show->addSlide(-main => '<IMG SRC=image.gif RESIZE>');
   $show->addSlide(-main => '<IMG SRC=image.gif RESIZE=0>');
In both cases, the resized version of the same image is shown! For the second use, I also could have written SRC=image, because the basename of the file is an alias for an already defined image.

Example 3: Predefining images

The previous example has a hazard: if you run your presentation out of order: start with the second slide and then the first. In that case, the image is not resized.

To avoid the hazard, but also to improve your possibilities to specify the images, you can define an image outside a slide:

   use PPresenter;
   my $show = PPresenter->new;
   $show->image(-file => 'image.gif', -resize => 0);
   $show->addSlide(-main => '<IMG SRC=image>');
   $show->addSlide(-main => '<IMG SRC=image>');
Calling the image() function, you can specify the options described in this manual-page. You can refer to the image under its filename, the basename of the filename, or other aliases (as with all PPresenter-objects, you may specify an option
    -aliases => [ 'alias', 'alias2', ... ]

Example 4: Reading the images yourself

It is possible to read the images yourself, in your Perl-program, and then offer it to PPresenter. The possibilities are different if you want to use Tk::Photo or Image::Magick; Tk::Photo images are related to a MainWindow (viewport), while Image::Magick images are not. Read their manual-pages for more details.

If you have created you own Photo or Magick image, you can add this to PPresenter with:

   $object = ...; # create Tk::Photo or Image::Magick object
   $show->image($object, -name => 'image');
You do not have to specify a name in case of Image::Magick (the output filename will be taken by default), but it is clearer this way.
Portable Presenter is written and maintained by Mark Overmeer. Copyright (C) 2000-2002, Free Software Foundation FSF.