[Israel.pm] GIMP and Perl

Shlomi Fish shlomif at iglu.org.il
Wed Mar 14 11:31:57 PDT 2007

On Saturday 10 March 2007, Yona Shlomo wrote:
> Hello,
> I'm looking for simple and easy instructions for performing the
> following task on a batch of files in Perl using GIMP.

Well, to do so you need to use the gimp-perl module:


Build it and install it. It may be included in your distribution already, but 
it's not part of the gimp installation.

Then you can do a similar loop to what you've shown by invoking the 
perl-server from the gimp menus (or in its startup command line scriptlet), 
and then running the perl script from the command line.

To find out what functions are needed to do what consult the GIMP's PDB 
(Procedural Database) Browser, or if all else fails - its mailing lists or 
source. The perl functions are the same as the ones in the PDB with "-" 
replaced by "_".

Good luck!


	Shlomi Fish

> foreach my $file (@jpg_gilenames) {
>  	my $gimp_obj= SOME::MODULE::GIMP::new($file);
>  	gimp_obj->unsharp_mask({radius=>0.1, amount=>1, threashold=>0});
>  	gimp_obj->saturation(30);
>  	gimp_obj->rotate($exiftool->orientation($file));
>  	gimp_obj->x_resolution({amount=>300, metrics=>'dpi'});
>  	gimp_obj->y_resolution({amount=>300, metrics=>'dpi'});
>  	gimp_obj->interpolation('cubic');
>  	gimp_obj->save({filename=>$file, quality=>100});
> }
> Any ideas?


Shlomi Fish      shlomif at iglu.org.il
Homepage:        http://www.shlomifish.org/

Chuck Norris wrote a complete Perl 6 implementation in a day but then
destroyed all evidence with his bare hands, so no one will know his secrets.

More information about the Perl mailing list