[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

Re: gEDA-user: automated converting .gsch to .png



> Could we see your ps2png script?

#!/usr/bin/perl
# -*- perl -*-

$res = 100;
$out1 = undef;

while ($ARGV[0] =~ /^-/) {
    $opt = shift;
    if ($opt eq "-r") {
	$res = shift;
    } elsif ($opt eq "-s") {
	$xsize = shift;
	$ysize = shift;
    } elsif ($opt eq "-o") {
	$out1 = shift;
    }
}

if ($xsize && $ysize) {
    $ph = $xsize;
    $pw = $ysize;
    $wres = $pw / 8.5;
    $hres = $ph / 11;
    $res = ($wres > $hres) ? $wres : $hres;
}

$pw = int(8.5 * $res);
$ph = int(11 * $res);


for $ps (@ARGV) {
    if ($out1) {
	$out = $out1;
    } else {
	$out = $ps;
	if ($out =~ /\.ps$/) {
	    $out =~ s/\.ps$/.png/;
	} else {
	    $out .= ".png";
	}
    }
    system
	"set -x;"
	. "gs -r$res -g${pw}x${ph} -q -dTextAlphaBits=4 -dGraphicsAlphaBits=2 -dNOPAUSE -dBATCH -sDEVICE=ppmraw -sOutputFile=- $ps"
	. "| pamflip -cw"
	. "| pnmtopng "
	. "> $out";
}


_______________________________________________
geda-user mailing list
geda-user@xxxxxxxxxxxxxx
http://www.seul.org/cgi-bin/mailman/listinfo/geda-user