MagickFloodfillPaintImage cannot remove the background
Posted: 2008-10-13T20:51:27-07:00
Tried to use *floodfill* to remove background and make it transparent but failed to work.
I downloaded the latest MagickWand php extension 1.0.7 and compiled with ImageMagick 6.4.4.
However, I find it frustrating to get *Floodfill* kinds of functions working? The image after calling MagickFloodfillPaintImage() remains the same even with a large fuzz factor. I've also tried the PHP Imagick
extension(http://us2.php.net/imagick), still have the same problem.
Am I missing something here? I have been scratching my head for days to figure out this problem. Any help is highly
appreciated. Thanks a lot.
-peter
convert --version
Version: ImageMagick 6.4.4 2008-10-08 Q16 http://www.imagemagick.org
Copyright: Copyright (C) 1999-2008 ImageMagick Studio LLC
// code sample using MagicWand PHP extension
<?php
$wand = NewMagickWand();
MagickReadImage($wand, 'test.png');
MagickFloodfillPaintImage($wand, NewPixelWand('transparent'), 50, NewPixelWand('white'), 10, 10);
echo MagickEchoImageBlob($wand);
?>
// code sampe using Imagick PHP extension
<?
$im = new Imagick('test.png');
$im->paintFloodfillImage(new ImagickPixel('transparent'), 50, new ImagickPixel('white'), 10, 10);
echo $im;
?>
I downloaded the latest MagickWand php extension 1.0.7 and compiled with ImageMagick 6.4.4.
However, I find it frustrating to get *Floodfill* kinds of functions working? The image after calling MagickFloodfillPaintImage() remains the same even with a large fuzz factor. I've also tried the PHP Imagick
extension(http://us2.php.net/imagick), still have the same problem.
Am I missing something here? I have been scratching my head for days to figure out this problem. Any help is highly
appreciated. Thanks a lot.
-peter
convert --version
Version: ImageMagick 6.4.4 2008-10-08 Q16 http://www.imagemagick.org
Copyright: Copyright (C) 1999-2008 ImageMagick Studio LLC
// code sample using MagicWand PHP extension
<?php
$wand = NewMagickWand();
MagickReadImage($wand, 'test.png');
MagickFloodfillPaintImage($wand, NewPixelWand('transparent'), 50, NewPixelWand('white'), 10, 10);
echo MagickEchoImageBlob($wand);
?>
// code sampe using Imagick PHP extension
<?
$im = new Imagick('test.png');
$im->paintFloodfillImage(new ImagickPixel('transparent'), 50, new ImagickPixel('white'), 10, 10);
echo $im;
?>