#!/usr/bin/perl -w
use strict;

# http://groups.google.com/groups?hl=en&lr=&ie=UTF-8&safe=off&threadm=Nb5n9.6664%24817.476%40nwrddc04.gnilink.net&rnum=2

use Gimp ":auto";
use Gimp::Fu;

sub psd_to_jpeg {
    my $file_in = shift;     # shift variables
    my $file_out = shift;     # sent by register

    my $img = file_psd_load(RUN_NONINTERACTIVE, $file_in, $file_in);
    my $flt = gimp_image_flatten($img);
 file_jpeg_save(RUN_NONINTERACTIVE, $img, $flt, $file_out, $file_out, 1, 0,
		0, 0, "Some info string", 0, 1, 0, 0);

    return $img;
}

psd_to_jpeg(@ARGV);
