I think I've worked it out, by sheer trial and error! The following code
seems to work:

use Image::Magick;

$gifs = new Image::Magick(size => "218x176");
$x = $gifs->Read('xc:red', 'png:test.png');
warn "$x" if "$x";
$gif = $gifs->Flatten();
warn "$x" if "$x";
$x = $gif->Write('gif:test.gif');
warn "$x" if "$x";

The problem was simply that I expected the Flatten command to act upon the
same IM object, I didn't understand that it "returns" a new object. In my
defence I would say that the Flatten command is only mentioned in passing in
the PerlMagick documentation and is not even listed with the other commands.

Thanks Ron for all your assistance - it was appreciated.

Chris

Important:

This email is sent on behalf of Trident Garages Ltd (www.tridentgarages.co.uk). 
Its contents are confidential to the intended recipient and may be legally 
privileged. If you are not the intended recipient: (1) you must not disclose, 
copy or distribute its contents to any other person, nor use its contents in 
any way; (2) please contact Trident Garages on +44 (0) 1932 874411 quoting the 
name of the sender and the addressee, then delete it from your system. Please 
accept our apologies for the inconvenience.

Trident has scanned this email for viruses but does not accept any 
responsibility once this email has been transmitted. You should scan 
attachments (if any) for viruses.

No contract may be concluded on behalf of Trident Garages Ltd, nor service of 
process accepted, by email.

Trident Garages Ltd is registered in England no. 764299. Registered office at 
Guildford Road, Ottershaw, Surrey KT16 0NZ

_______________________________________________
Magick-users mailing list
[email protected]
http://studio.imagemagick.org/mailman/listinfo/magick-users

Reply via email to