You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

18 lines
588 B

#!/usr/bin/perl
$dirname="./";
opendir( DIR, $dirname );
while( defined($file = readdir(DIR)) ) {
if ( $file =~ /\.png$/ ) {
$inputfile = $file;
$file =~ s/\.png$/\.xpm/;
$outputfile = $file;
$file =~ s/\.xpm$//;
$iconname = $file;
#generate alpha mask
system("cat $dirname/$inputfile | pngtopnm -alpha > alpha_mask.ppm");
#generate icon
system("cat $dirname/$inputfile | pngtopnm | ppmtoxpm -alphamask=alpha_mask.ppm -name $iconname | sed -e 's/char \\*/const char \\*/' > $dirname/$outputfile \n");
}
}
closedir( DIR );