Liberating the Stemmario Trivulziano

The Stemmario Trivulziano is a fifteenth-century Italian armorial featuring the Milan’s ruling family the Visconti and many of their allies and neighbors, believed to be painted by Gian Antonio da Tradate somewhere around around 1475. It takes its name from its owner, Gian Giacomo Trivulzio, an independent mercenary commander, who might have made good use of it in identifying military units on the battlefields of Italy.

Unfortunately, for a long time the only way to view the Stemmario Trivulziano has been to either finagle an invitation to the library where it is held inside Milan’s Sforza Castle, or to purchase a lovely bound edition for € 296 (about $350). As those options were both out of the reach of many amateur armorialists, the rest of us had to make do with a few isolated pages which had been scanned and posted online.

As a result, I was startled to see a message this evening saying that the entire armorial had been found online, on a web site run by the city of Milan.

Access to the book was limited to a “click to pan and zoom” interface that makes browsing less convenient than I would like, so I whipped up a quick Perl script to fetch the entire book as high-resolution images, which took about three hours to run. (This could easily be sped up but I figured it was better to spread out the load on the Milanese web site.)

#!/usr/bin/perl

my $img_base = 'http://graficheincomune.comune.milano.it/' . 'GraficheInComune/imgdbs/web/BibliotecaTrivulziana/Manoscritti/' . 'Cod.%20Triv.%201390/Cod.%20Triv.%201390,%20';

my %skips = map { $_ => 1 } ( 71, 72, 229, 230, 399 .. 420, 423 .. 442 );
my @pages = ( 
    "piatto anteriore", "contropiatto anteriore", 
    ( map { "c. $_" } qw( Ir Iv IIr IIv IIIr IIIv IVr IVv Vr Vv VIr VIv VIIr VIIv VIIIr VIIIv IXr IXv Xr Xv ) ),
    ( map { "p. $_" } grep { ! $skips{ $_ } } ( 3 .. 450 ) ),
    ( map { "c. $_" } qw( I'r I'v II'r II'v ) ),
    "contropiatto posteriore", "piatto posteriore", "dorso", 
    "taglio superiore", "taglio laterale", "taglio inferiore" 
);

my $seq;
foreach my $page ( @pages ) {
    $seq ++;
    my $file = sprintf( "%03d-$page", $seq );
    $file =~ s/ /-/g;
    $page =~ s/ /%20/g;
    
    foreach my $y ( 0 .. 5 ) {
        foreach my $x ( 0 .. 4 ) {
            qx{ curl -o $file-$y-$x.jpeg $img_base$page/12/${x}_$y.jpg };
        }
    }
    qx{ montage $file-*.jpeg -geometry +0+0 -tile 5x6 $file.jpeg };
    qx{ rm $file-*.jpeg };
}

The result is a directory full of 434 JPEG files averaging just over 2 MB each, which I combined into a PDF file after removing the blank pages.

As with the other armorials I’ve processed in recent months, I am making available a lower-quality version of this PDF file (compressed down to just 49 MB rather than the full 677 MB size) for use by those who are not able to run the above script themselves.

Leave a Reply

Your email address will not be published. Required fields are marked *