Heya All,

Below is some perl I'm working on.  The idea is to automate the conversion
of an image's bg colo(u)r to another colour of choice.  I need advice. :)

- I'm not totally happy with the output my script produces - toying with the 
  threshold parameter in by_color_select can reduce the anti-aliasing
  problems with the conversion of BG colour, but its not the best solution. 
  Is there a process I should be using to improve the final output?  The DB
  index for by_color_select indicates anti-aliasing functionality, but
  apparently not what I thought it'd do.

Thanks,
Charles
(I'm running gimp1.1.19 under redhat 6.1 with Gimp.pm v1.1]


#!/usr/bin/perl

use Gimp qw (:auto);
use Gimp::Fu;

register "bgconvert",
         "convert a BG to another BG",
         "see above",
         "Charles Brasted",
         "Charles Brasted",
         "1.0",
         "<Image>/Filters/Misc/bgconvert",
         "RGB*, GRAY*",
         [
          [PF_COLOUR,   "bg_color",     "the background colour","pink"]
         ],
         sub {
   my($img,$drawable,$bg_new)=@_;
   $bg = gimp_palette_get_background();
   $drawable = $img->flatten;
   $drawable->add_alpha;
   $drawable->by_color_select($bg,100,2,1,0,0,0);
   gimp_palette_set_background($bg_new);
   $drawable->bucket_fill(1,0, 100,255,0,0,0);
   $img;
};

exit main;



Reply via email to