blend

Blend two images together with the first image as the base and the second image on top. Supports several blend modes.

blend ( ImageInterface &$image1, ImageInterface $image2, string $type = 'normal', float $opacity = 1, string $position = 'top-left', int $offsetX = 0, int $offsetY = 0 ): EditorInterface 
Parameters
image1

The base image.

image2

The image placed on top of the base image.

type

The blend mode. Can be: normal, multiply, overlay or screen.

opacity

The opacity of $image2. Possible values 0.0 to 1.0 where 0.0 is fully transparent and 1.0 is fully opaque. Defaults to 1.0.

position

The position of $image2 on $image1. Possible values top-left, top-center, top-right, center-left, center, center-right, bottom-left, bottom-center, bottom-right and smart. Defaults to top-left.

offsetX

Number of pixels to add to the X position of $image2.

offsetY

Number of pixels to add to the Y position of $image2.

Returns
An instance of Editor.
Examples
$input1 = 'lena.png';
$input2 = 'blend.png';
$output = 'test.jpg';

$image1 = Grafika::createImage( $input1 );
$image2 = Grafika::createImage( $input2 );
$editor->blend( $image1, $image2, 'overlay', 0.5, 'center' ); // overlay blend, opacity 50%, center position
$editor->save( $image1, $output );

Image 1:
lena
Image 2:
blend

Output:
test