Graphics::DZI::Files - DeepZoom Image Pyramid Generation, File-based


  use Graphics::DZI::Files;
  my $dzi = new Graphics::DZI::Files (image    => $image,
                                      overlap  => 4,
                                      tilesize => 256,
                                      scale    => 2,
                                      format   => 'png',
                                      prefix   => 'xxx',
                                      path     => '/where/ever/');
  use File::Slurp;
  write_file ('/where/ever/xxx.xml', $dzi->descriptor);
  $dzi->iterate ();

  # since 0.05
  use Graphics::DZI::Files;
  my $dzi = new Graphics::DZI::Files (image => $image,
                                      dzi   => '/tmp/xxx.dzi');


This subclass of Graphics::DZI generates tiles and stores them at the specified path location.



Additional to the parent class Graphics::DZI, the constructor takes the following fields:

format (default png):

An image format (png, jpg, ...). Any format Image::Magick understands will do.

path: (deprecated from 0.05 onwards, use dzi)

A directory name (including trailing /) where the tiles are written to. This has to include the _files part required by the DZI format.

prefix: (deprecated from 0.05 onwards, use dzi)

The string to be prefixed the _files/ part in the directory name. Usually the name of the image to be converted. No slashes.

dzi (since 0.05)

Alternatively to specifying the path and the prefix separately, you can also provide the full path to the DZI file, say, /var/www/photo.dzi. The tiles will be written to /var/www/photo_files.



(since 0.05)

This method generates everything, the tiles and the XML descriptor. If you have specified a dzi field in the constructor, then you do not need to specify it as parameter. If you have used the path/prefix, then you need to provide the full path.


This method writes any tile to a file, appropriately named for DZI inclusion.


Robert Barta, <drrho at>


Copyright 2010 Robert Barta, all rights reserved.

This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.