#!/local/bin/perl

use Getopt::Std;
use File::PathConvert qw(realpath);
my $gimp_client = "gimpclient";

my %opts;
getopts('h:p:', \%opts);

my $host   = ($opts{h} ? $opts{h} : 'localhost'); 
my $port   = ($opts{p} ? $opts{p} : '10008');

($filein) = @ARGV;

$filein = realpath ($filein);

open (GIMP, "| $gimp_client -h $host -p $port") || die "Cannot start $gimp_client";

print GIMP <<EOF;
(let* ((img (car (gimp-file-load 1 \"$filein\" \"$filein\")))) (gimp-display-new img))
EOF

close GIMP;

