#!/usr/bin/perl
#
# Name:
#	im-hax-transparent-2.pl.
#
# Purpose:
#	Create a transparent image.
#
# V 1.01 20-Feb-2002
# ------------------
# o Add a border round the image
#
# V 1.00 17-Jan-2002
# ------------------
# o Initial version
#
# Test environment:
#	OS: WinNT 4 SP 6a
#	Web server: Apache V 1.3.26
#	IM: V 5.4.7

#
# Input files:
#	None.
#
# Output files:
#	im-hax-transparent-2.gif.
#
# Note:
#	o tab = 4 spaces || die.
#	o Text reformatted to max 50 chars wide
#		so source can be converted to PDF
#
# Author:
#	Ron Savage <ron@savage.net.au>
#	http://savage.net.au/ImageMagick.html
#
# Licence:
#	Copyright (c) 1999-2002 Ron Savage
#
#	All Programs of mine are
#	'OSI Certified Open Source Software';
#	you can redistribute them and/or modify them
#	under the terms of the Artistic License,
#	a copy of which is available at:
#	http://www.opensource.org/licenses/index.html

use strict;
use warnings;

use Image::Magick;

# -----------------------------------------------

my($work_dir_name) = '/temp';

chdir($work_dir_name)
|| die("Can't chdir($work_dir_name): $!");

my($im_version) = $Image::Magick::VERSION;
print "Image::Magick V $im_version. \n";
print "\n";

my($output_file_name)	=
	'im-hax-transparent-2.gif';
my($image)				= Image::Magick -> new();
my($width)				= 30;
my($height)				= 30;
my($result)				=
	$image -> Set(size => "${width}x$height");
warn $result if $result;

$result = $image -> Read('xc:red');
warn $result if $result;

$result = $image -> Draw
(
	primitive	=> 'matte',
	method		=> 'replace',
	points		=> '0,0',
);
warn $result if $result;

$result = $image -> Border
(
	width	=> 2,
	height	=> 2,
	fill	=> 'cyan',
);
warn $result if $result;

$result = $image -> Write($output_file_name);
warn $result if $result;

print "Wrote $output_file_name. \n";
