matteFloodfillImage doesn't work as expected

IMagick is a native PHP extension to create and modify images using the ImageMagick API. ImageMagick Studio LLC did not write nor does it maintain the IMagick extension, however, IMagick users are welcome to discuss the extension here.
Post Reply
colorpyen

matteFloodfillImage doesn't work as expected

Post by colorpyen »

Using latest imagick PHP extension downloaded from PECL 2.2.1RC2 and ImageMagick version 6.4.4

Tried to mimic the similar behavior of the following script to remove background using Imagick extension, but failed to get it work using Imagick even with a larger fuzz factor. Any pointers are highly appreciated.

Thanks a lot.

-peter

convert test.png -bordercolor white -border 1x1 -matte \
-fill none -fuzz 1% -draw 'matte 1,1 floodfill' test.png

<?php

$im = new Imagick('test.png');
$im->matteFloodfillImage(1.0, 50, new ImagickPixel('white'), 10, 10);
echo $im;
?>
colnector

Re: matteFloodfillImage doesn't work as expected

Post by colnector »

I've tried it as well and couldn't get it to work. It seems this forum is dead :(

viewtopic.php?f=18&t=12118
mkoppanen
Posts: 309
Joined: 2007-06-09T07:06:32-07:00

Re: matteFloodfillImage doesn't work as expected

Post by mkoppanen »

Far from dead :)

I am currently very busy at work so that cuts down the time I can "hang around" at forums. This should ease up after Wednesday!
Mikko Koppanen
My blog: http://valokuva.org
colnector

Re: matteFloodfillImage doesn't work as expected

Post by colnector »

Well, if I get a good complete answer on Wednesday I'll be happy. 10x
pooco

Re: matteFloodfillImage doesn't work as expected

Post by pooco »

same issue; doesnt work as expected. anyone get this going?
colnector

Re: matteFloodfillImage doesn't work as expected

Post by colnector »

This is the part of the code that currently work more or less well for collectible coins on my site

Code: Select all

			if ($bFakeTransparency) {
				$ipColor = $im->getImagePixelColor(1, 1);
				$im->borderImage($ipColor, 1, 1);
				
				$im->paintFloodfillImage("#e8f0fc", 12000, $ipColor, 1 , 1);
				$im->shaveImage(1, 1);		
			}	
pooco

Re: matteFloodfillImage doesn't work as expected

Post by pooco »

thank you!
was just about to post this:

$canvas->paintTransparentImage('color', 0, 400);

read more in user comments here:
http://www.php.net/manual/en/function.i ... timage.php

hopefully i can figure out better png alpha transparency support now.
colnector

Re: matteFloodfillImage doesn't work as expected

Post by colnector »

You're most welcomed :) I was actually using this method since I'm displaying JPGs. Using PNGs is out of the question due to image size. If new ideas come to mind (you can see on my site not all the automatic choices are perfect, to say the least), please update. Thanks.
Post Reply