HomeImagickImagickDrawImagickPixelImagick Pixel IteratorImagick KernelDevelopmentTutorial Source codeReport an issue
Category
Example

Polaroid image with text and method

← polaroidImage   posterizeImage →

Example

function polaroidWithTextAndMethod(
    string $image_path,
    string $text,
    int $interpolate_type,
    float $angle,
    $fill_color,
    $stroke_color
) {
    $imagick = new \Imagick(realpath($image_path));
    $imagickDraw = new \ImagickDraw();

//    $font = findDefaultFont();
//    $imagickDraw->setFont($font);
    $imagickDraw->setFontSize(16);
//    $imagickDraw->setStrokeColor($stroke_color);
//    $imagickDraw->setFillColor($fill_color);
    $imagick->polaroidWithTextAndMethod(
        $imagickDraw,
        $angle,
        $text,
        $interpolate_type
    );
    header("Content-Type: image/jpeg");
    echo $imagick->getImageBlob();
}