Файл: vendor/intervention/image/src/Drivers/Imagick/Modifiers/BlendTransparencyModifier.php
Строк: 57
<?php
declare(strict_types=1);
namespace InterventionImageDriversImagickModifiers;
use Imagick;
use InterventionImageInterfacesImageInterface;
use InterventionImageInterfacesSpecializedInterface;
use InterventionImageModifiersBlendTransparencyModifier as GenericBlendTransparencyModifier;
class BlendTransparencyModifier extends GenericBlendTransparencyModifier implements SpecializedInterface
{
public function apply(ImageInterface $image): ImageInterface
{
$blendingColor = $this->blendingColor($this->driver());
// get imagickpixel from blending color
$pixel = $this->driver()
->colorProcessor($image->colorspace())
->colorToNative($blendingColor);
// 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;
}
}