The imageantialias() function is an inbuilt function in PHP which is used to check whether antialias function is used or not. This function activate the fast drawing anti-aliased methods for lines and wired polygons. It works only with truecolor images.
Syntax:
bool imageantialias( $image, $enabled )
Parameters: This function accepts two parameters as mentioned above and described below:
- $image: An image resource, returned by one of the image creation functions, such as imagecreatetruecolor().
- $enabled: This parameter is used to check whether enable antialiasing or not.
Return Value: This function returns True on success or False on failure.
Note: The imageantialias() function is now available. It was only available if PHP was compiled against version of the GD library.
Below program illustrates the imageantialias() function.
Program 1:
<?php // Function to create image of given size $antialias_img = imagecreatetruecolor(800, 200); $normal_img = imagecreatetruecolor(400, 200); // Switch antialiasing on for one image imageantialias($antialias_img, true); // Allocate the color for image $white = imagecolorallocate($normal_img, 255, 255, 255); $white_anti_aliased = imagecolorallocate($antialias_img, 255, 255, 255); // Draw two lines, one with antialiasing enabled imageline($normal_img, 0, 0, 400, 200, $white); imageline($antialias_img, 0, 0, 400, 200, $white_anti_aliased); // Merge the two images side by side for output imagecopymerge($antialias_img, $normal_img, 400, 0, 0, 0, 400, 200, 200); // Output image header('Content-type: image/png'); imagepng($antialias_img); imagedestroy($antialias_img); imagedestroy($normal_img_img); ?> |
Output:

Reference: http://php.net/manual/en/function.imageantialias.php
Recommended Posts:
- How to get the function name inside a function in PHP ?
- PHP 5 vs PHP 7
- PHP | Get PHP configuration information using phpinfo()
- PHP | php.ini File Configuration
- How to import config.php file in a PHP script ?
- PHP | imagecreatetruecolor() Function
- PHP | fpassthru( ) Function
- PHP | ImagickDraw getTextAlignment() Function
- PHP | Ds\Sequence last() Function
- PHP | Imagick floodFillPaintImage() Function
- Function to escape regex patterns before applied in PHP
- PHP | array_udiff_uassoc() Function
- PHP | geoip_continent_code_by_name() Function
- PHP | GmagickPixel setcolor() function
- PHP | opendir() Function
- PHP | cal_to_jd() Function
- PHP | stream_get_transports() Function
- PHP | Ds\Deque pop() Function
- PHP | SimpleXMLElement children() Function
- PHP | array_intersect_ukey() Function
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to contribute@geeksforgeeks.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.

