<?php

define
('IDENTIFY''/usr/bin/identify');

array_shift($argv);

foreach (
$argv as $filename) {
    
$stick_out gif_geometry_stick_out($filename);
    
$stick_out_str = ($stick_out)?'true':'false';
    echo 
"$stick_out_str $filename\n";
}

function 
gif_geometry_stick_out($filename) {
    
$cmd IDENTIFY $filename";
    
$result = `$cmd`;
    
// "foo.gif GIF 24x25 24x24+0+0 PseudoClass 256c 1kb
    
if (preg_match('/(\S+) (\S+) (\d+)x(\d+) (\d+)x(\d+)\+(\d+)\+(\d+) PseudoClass /'$result$matches)) {
        list(
$line$name$format$columns$rows$width$height$x$y) = $matches;
    } else {
        echo 
"Invalid identify result format: $result\n";
        exit(
1);
    }
    
// var translation for ImageMagick BUG
    
$screen_width $width;
    
$screen_height $height;
    
$page_width $columns;
    
$page_height $rows;
    
$page_x $x;
    
$page_y $y;

    
$stick_out false;
    if ((
$screen_width < ($page_x $page_width)) ||
        (
$screen_height < ($page_y $page_height))) {
            
$stick_out true;
    }
    return 
$stick_out;
}