Page 1 of 1

help to create colored regtanc with black border

Posted: 2013-10-09T05:33:22-07:00
by jan99
hi !

i try to create images with a colored background and a black border.

my source now is:

Code: Select all

#!/usr/bin/perl
use strict;
use warnings;
use Image::Magick;

my $red = $ARGV[1];
my $green = $ARGV[2];
my $blue = $ARGV[3];
my $name = $ARGV[0] || '' ;

print "red: ".$red."\n";
print "green: ".$green."\n";
print "blue: ".$blue."\n";
print "name: ".$name."\n";
my $warn;

my $DEBUG = 1;

# Dateiname

my $color_hex = sprintf "#%02X%02X%02X",$red,$green,$blue;
warn $color_hex if $DEBUG;

# Objekt für Bilder erzeugen
my $img = Image::Magick->new();

 # Bildgröße setzen
$img->Set(size=>'30x20', fill => 'white');

$img->Draw(primitive=>'rectangle', points=>'10,1 15,20', strokewidth=>1,stroke=>'Black');

 # Bild mit Farbe erzeugen
$img->ReadImage("xc:$color_hex");

$name = $name."_" if ($name ne '');

$warn = $img->Write($name.$red."_".$green."_".$blue.".gif");
die $warn if $warn;
but the result is not my wish! could someone help me?

regards Jan :-)