EXA Download Perl Script

I put together this little quick-and-dirty Perl script to extract period armorials from point-and-click hosting services that used the EXAwebpaper hosting service from EXACON-IT, an Austrian technology company.

To run it, you will need the ImageMagick tools, which provide the montage command that stitches image tiles together. Mac users can install ImageMagick using the following commands:

# Install Homebrew
ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"

# Install Dependencies
brew install imagemagick

Then save the code below as a Perl script named exa_extract.pl:

#!/usr/bin/perl

my $base_url = $ARGV[0];

foreach ( 1 .. $ARGV[1] ) {
    my $page = sprintf( "%04d", $_ );
    foreach ( 0 .. 63 ) {
        my $tile = sprintf( "%02d", $_ );
        qx{ curl -o page_$page-tile_$tile.jpeg $base_url/$page/__00000$tile.jpg };
    }
    qx{ montage page_$page-tile_*.jpeg -geometry +0+0 -tile 8x8 page_$page.jpeg };
    qx{ rm page_$page-tile_*.jpeg };
}

Lastly, make a new empty directory, set it as your current working directory, and invoke the script using the base URL of a manuscript and the total number of pages:

perl exa_extract.pl http://bilderserver.at/wappenbuecher/WienerHandschriftEXAv2_52z3/img 324

That script will take several minutes to run and then exit, leaving you with a series of high-resolution JPEG images, one per page.