#!/usr/bin/perl
#
# Name:
#	im-hax-make-label-1.pl.
#
# Purpose:
#	Demonstrate how to make an image which
#	contains a string of text.
#
# V 1.00 01-May-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-make-label-1.png
#
# 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';
my($im_version)		= $Image::Magick::VERSION;

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

print "Image::Magick V $im_version. \n";
print "\n";

my($file_name)	= 'im-hax-make-label-1.png';
my($i)			= Image::Magick -> new();

my($result);

$result	= $i -> Set
(
	font		=> 'Papyrus',
	pointsize	=> 40,
);
die $result if $result;

$result	= $i -> Read('label:Hello World');
die $result if $result;

$result	= $i -> Border
(
	geometry	=> '1x1',
	fill		=> 'red',
);
die $result if $result;

my($w, $h)	= $i -> Get('width', 'height');
print "test.png: $w x $h\n";

$result = $i -> Write($file_name);
die $result if $result;
print "Wrote: $file_name\n";
