Commit 9e906611 authored by Mac Newbold's avatar Mac Newbold

Remove huge borders around gif/png images, and fix size of images to be the same as the .ps file.

parent f0953873
......@@ -199,7 +199,15 @@ sub doformats() {
system("cp $in $out.ps");
}
if (!($gif || $png)) { return; }
system("pstopnm -stdout $in > $in.ppm 2> /dev/null");
my $opt = "-stdout -xborder 0 -yborder 0 ";
my $box = `grep %%BoundingBox $in`;
if ($box =~ /%%BoundingBox:\s+(\d+)\s+(\d+)\s+(\d+)\s+(\d+)/) {
my ($xmin,$ymin,$xmax,$ymax) = ($1, $2, $3, $4);
my $xsize=$xmax-$xmin;
my $ysize=$ymax-$ymin;
$opt .="-xsize $xsize -ysize $ysize";
}
system("pstopnm $opt $in > $in.ppm 2> /dev/null");
if ($gif) {
print "gif ";
system("ppmtogif $in.ppm > $out.gif 2> /dev/null");
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment