driver()->handleInput( $this->color ? $this->color : $this->driver()->config()->blendingColor ); // get imagickpixel from color $pixel = $this->driver() ->colorProcessor($image->colorspace()) ->colorToNative($color); // merge transparent areas with the background color foreach ($image as $frame) { $frame->native()->setImageBackgroundColor($pixel); $frame->native()->setImageAlphaChannel(Imagick::ALPHACHANNEL_REMOVE); $frame->native()->mergeImageLayers(Imagick::LAYERMETHOD_FLATTEN); } return $image; } }