Hi All,

I have just written a couple of little perl scripts to convert existing
gimp-1.2.x palettes and gradients into a form that gimp-1.3.20 finds
acceptable.  In the hope that others might find them useful, I have
attached them.

Happy Gimping!
-- 

--Jeff

Jeff Trefftzs <[EMAIL PROTECTED]>
http://www.tcsn.net/trefftzs                    Home Page
http://gug.sunsite.dk/gallery.php?artist=68     Gimp Gallery
http://trefftzs.topcities.com/                  Photo Gallery 
#!/bin/env perl

#  grad2-1.3.pl:  convert gimp gradients from old (1.2 format) to
#  gimp-1.3 format by adding a Name:  gradient name line and a .ggr
#  extension to the output file.

#  usage:  grad2-1.3.pl <list of old gradients> <output directory>

use strict;
use File::Basename;

#  Make sure the last arg is a target directory
my $outdir = $ARGV[$#ARGV];
die "grad2-1.3.pl:  last parameter should be a directory.\n" unless (-d $outdir);
if (substr($outdir, length($outdir), 1) ne '/') {
  $outdir .= '/';
}
$#ARGV--;

#  Get the first gradient name
my ($fname, $path, $ext) = fileparse($ARGV[0]);
print STDERR "$fname\n";
my $outfname = $outdir . $fname . '.ggr'; # .ggr extension
print STDERR "Outfname is $outfname\n";
open(GRAD, ">$outfname") or die "Can't open output file\n";

while(<>) {
  if ($. == 2) {
    my $gradname = $fname;
    $gradname =~ s/_/ /g;	# convert underscores to spaces
    print GRAD "Name: $gradname\n";
  }
  print GRAD;
  next unless (eof);
  close ARGV;			# reset line numbers
  last unless ($ARGV[0]);
  close GRAD;
  ($fname, $path, $ext) = fileparse($ARGV[0]);
  $outfname = $outdir . $fname . '.ggr';
  print STDERR "$fname\n";
  print STDERR "Outfilename is $outfname\n";
  open(GRAD, ">$outfname") or die "Can't open output file\n";
}
close GRAD;


#!/bin/env perl

#  palette2-1.3.pl:  convert gimp paletteients from old (1.2 format) to
#  gimp-1.3 format by adding a Name:  palette name line and a .gbr
#  extension to the output file.

#  usage:  palette2-1.3.pl <list of old palettes> <output directory>

use strict;
use File::Basename;

#  Make sure the last arg is a target directory
my $outdir = $ARGV[$#ARGV];
die "palette2-1.3.pl:  last parameter should be a directory.\n" unless (-d $outdir);
if (substr($outdir, length($outdir), 1) ne '/') {
  $outdir .= '/';
}
$#ARGV--;

#  Get the first palette name
my ($fname, $path, $ext) = fileparse($ARGV[0]);
print STDERR "$fname\n";
my $outfname = $outdir . $fname . '.gpl'; # .gpl extension
print STDERR "Outfname is $outfname\n";
open(PALETTE, ">$outfname") or die "Can't open output file\n";

while(<>) {
  if ($. == 2) {
    my $palettename = $fname;
    $palettename =~ s/_/ /g;	# convert underscores to spaces
    print PALETTE "Name: $palettename\n";
  }
  print PALETTE;
  next unless (eof);
  close ARGV;			# reset line numbers
  last unless ($ARGV[0]);
  close PALETTE;
  ($fname, $path, $ext) = fileparse($ARGV[0]);
  $outfname = $outdir . $fname . '.gpl';
  print STDERR "$fname\n";
  print STDERR "Outfilename is $outfname\n";
  open(PALETTE, ">$outfname") or die "Can't open output file\n";
}
close PALETTE;


_______________________________________________
Gimp-user mailing list
[EMAIL PROTECTED]
http://lists.xcf.berkeley.edu/mailman/listinfo/gimp-user

Reply via email to