Wednesday, January 21, 2026
HomeLanguagesPHP | ImagickDraw getStrokeAntialias() Function

PHP | ImagickDraw getStrokeAntialias() Function

The ImagickDraw::getStrokeAntialias() function is an inbuilt function in PHP which is used to get the current stroke antialias setting. Stroked outlines are antialiased (enabled) by default. Alias is just a noise or distortion in the stroke.

Syntax:

bool ImagickDraw::getStrokeAntialias( void )

Parameters: This function doesn’t accept any parameter.

Return Value: This function returns an bool value containing the stroke antialias setting. TRUE means enabled and FALSE means disabled.

Exceptions: This function throws ImagickException on error.

Below given programs illustrate the ImagickDraw::getStrokeAntialias() function in PHP:

Program 1:




<?php
  
// Create a new ImagickDraw object
$draw = new ImagickDraw();
  
// Get the stroke antialias
$strokeAntialias = $draw->getStrokeAntialias() ? 'true' : 'false';
echo $strokeAntilias;
?>


Output:

true

Program 2:




<?php
  
// Create a new ImagickDraw object
$draw = new ImagickDraw();
  
// Disable stroke antialias
$draw->setStrokeAntialias(false);
  
// Get the stroke antialias
$strokeAntialias = $draw->getStrokeAntialias() ? 'true' : 'false';
echo $strokeAntilias;
?>


Output:

false

Program 3:




<?php
  
// Create a new imagick object
$imagick = new Imagick();
  
// Create a image on imagick object
$imagick->newImage(800, 250, 'black');
  
// Create a new ImagickDraw object
$draw = new ImagickDraw();
  
// Set the fill color
$draw->setFillColor('cyan');
  
// Set the width of stroke
$draw->setStrokeWidth(1);
  
// Set the color of stroke
$draw->setStrokeColor('red');
  
// Set the font size
$draw->setFontSize(40);
  
// Get the stroke antialias
$strokeAntialias = $draw->getStrokeAntialias() ? 'true' : 'false';
  
// Annotate a text
$draw->annotation(50, 100, 'The stroke antialias here is ' . $strokeAntialias);
  
// Disable stroke antialias
$draw->setStrokeAntialias(false);
  
// Get the stroke antialias
$strokeAntialias = $draw->getStrokeAntialias() ? 'true' : 'false';
  
// Annotate a text
$draw->annotation(50, 200, 'The stroke antialias here is ' . $strokeAntialias);
  
// Render the draw commands
$imagick->drawImage($draw);
  
// Show the output
$imagick->setImageFormat('png');
header("Content-Type: image/png");
echo $imagick->getImageBlob();
?>


Output:

Reference: https://www.php.net/manual/en/imagickdraw.getstrokeantialias.php

Whether you’re preparing for your first job interview or aiming to upskill in this ever-evolving tech landscape, neveropen Courses are your key to success. We provide top-quality content at affordable prices, all geared towards accelerating your growth in a time-bound manner. Join the millions we’ve already empowered, and we’re here to do the same for you. Don’t miss out – check it out now!
RELATED ARTICLES

Most Popular

Dominic
32475 POSTS0 COMMENTS
Milvus
119 POSTS0 COMMENTS
Nango Kala
6847 POSTS0 COMMENTS
Nicole Veronica
11977 POSTS0 COMMENTS
Nokonwaba Nkukhwana
12064 POSTS0 COMMENTS
Shaida Kate Naidoo
6986 POSTS0 COMMENTS
Ted Musemwa
7220 POSTS0 COMMENTS
Thapelo Manthata
6933 POSTS0 COMMENTS
Umr Jansen
6912 POSTS0 COMMENTS