Page 1 of 1

scaleImage and remove image background

Posted: 2014-07-11T12:28:44-07:00
by smartscript
Hi

What i'm trying to do is to scale logo uploads and also make the image background transparent but only if the background is white.

I'm scaling the image using PHP code below.

Please can anyone help?

Code: Select all


function MakeThumb($height, $width, $original, $new_file, $mime_type)
	{
		// iMagick
		if(class_exists('Imagick')) 
		{
			$thumb = new Imagick($original);
			$thumb->scaleImage($width, $height, true);
			$thumb->writeImage($new_file);
			$thumb->destroy();
		}
	}

Re: scaleImage and remove image background

Posted: 2014-07-11T14:08:56-07:00
by fmw42
In command line you would use -fuzz XX% -transparent white. See if there are Imagick commands to do that. If you make -fuzz with XX=0 or leave it off, then it will only make exactly (pure) white pixels transparent.

see http://us3.php.net/manual/en/imagick.tr ... timage.php