added padding to end of bitmap download
authorDobrica Pavlinusic <dpavlin@rot13.org>
Sun, 15 Aug 2010 13:40:38 +0000 (15:40 +0200)
committerDobrica Pavlinusic <dpavlin@rot13.org>
Sun, 15 Aug 2010 13:40:38 +0000 (15:40 +0200)
ghostscript sometimes produce smaller pbm files due to rounding
errors from points to pixels and back

scripts/evolis-driver.pl

index ed04e61..2001917 100755 (executable)
@@ -54,5 +54,9 @@ sub read_pbm {
        local $/ = undef;
        my $data = <$pbm>;
        warn "# $path $size ", length($data), " bytes\n";
+       if ( my $padding = ( 648 * 1016 / 8 - length($data) ) ) {
+               warn "# adding $padding zero bytes padding\n";
+               $data .= "\x00" x $padding;
+       }
        return $data;
 }