Believe I figured it out, via a small trip through PPM format. I marked this thread as solved.
The solution is to make sure the lines are not Antialiased.
Thanks for response and link, snibgo
In case anyone can use the script:
Code: Select all
## ------------ perl script for making grids ----------------------
##
use Image::Magick;
use Getopt::Long;
use Pod::Usage;
my $width = 5000;
my $height = 1200;
my $lineoffset = 600;
my $linewidth = 4;
my $man = 0;
$res = GetOptions("width|w=i" => \$width, # width
"height|h=i" => \$height,
"offset|o=i" => \$lineoffset,
"line|l=i" => \$linewidth );
my($image, $p, $q);
pod2usage(-verbose => 2) if $helpme;
print STDERR <<DEB;
========================================
Parameters:
-------------
Width = $width
Height = $height
Offset = $lineoffset
Line = $linewidth
Font = $fontheight
========================================
DEB
# pixels between each line
my $cur_x = 0; # current line pos
$image = Image::Magick->new (size=>$width . "x" . $height);
$image->Read('xc:white');
# VERTICAL LINES
while ($cur_x < $width) {
$lineno = 0;
my $pts = $cur_x . ',' . 1;
my $pts2 = $cur_x . ',' . $height;
print STDERR $pts . ' ' . $pts2;
print STDERR "\n";
$image->Draw(
primitive=>'line',
points=> $pts . ' ' . $pts2,
stroke=>'black',
strokewidth=>$linewidth,
antialias=>false # <<< important to include this
);
$cur_x += $lineoffset;
}
# HORIZONTAL LINES
my $cur_y = 0;
while ($cur_y < $height) {
$lineno = 0;
my $pts = 1 . ',' . $cur_y;
my $pts2 = $width . ',' . $cur_y;
print STDERR $pts . ' ' . $pts2;
print STDERR "\n";
$image->Draw(
primitive=>'line',
points=> $pts . ' ' . $pts2,
stroke=>'black',
strokewidth=>$linewidth,
antialias=>false # <<< important to include this
);
$cur_y += $lineoffset;
}
$r = $image->Set(
colors=>"2",
depth=>"0",
antialias=>"false",
type=>'bilevel',
);
warn "$r" if "$r";
my $ofn = "grid_w".$width . "_h" .$height. "_" .$lineoffset."x".$linewidth.".bmp";
print STDERR "Writing to $ofn\n";
$image->Write($ofn);
undef $image;
__END__