The ImagickDraw::point() function is an inbuilt function in Imagick library of PHP which is used to draw a point. This function uses current stroke color and stroke thickness at the specified coordinates.
Syntax:
bool ImagickDraw::point( $x, $y )
Parameters: This function accepts two parameters as mentioned above and described below:
- $x: This parameter is used to hold the value of x coordinate.
- $y: This parameter is used to hold the value of y coordinate.
Return Value: This function returns TRUE on success.
Below program illustrates the ImagickDraw::point() function in PHP:
Program:
<?php // Create an ImagickDraw object $draw = new \ImagickDraw(); // Set the filled color $draw->setFillColor('red'); // Use loop to draw 10000 points in given area for ($x = 0; $x < 10000; $x++) { $draw->point(rand(0, 300), rand(0, 300)); } // Create an Imagick object $imagick = new \Imagick(); // Set the new image size $imagick->newImage(300, 300, 'white'); // Set the image format $imagick->setImageFormat("png"); // Function to draw the image $imagick->drawImage($draw); header("Content-Type: image/png"); // Display the output image echo $imagick->getImageBlob(); ?> |
Output:

Reference: http://php.net/manual/en/imagickdraw.point.php
Recommended Posts:
- PHP | ImagickDraw getTextAlignment() Function
- PHP | ImagickDraw scale() Function
- PHP | ImagickDraw roundRectangle() Function
- PHP | ImagickDraw arc() Function
- PHP | ImagickDraw circle() Function
- PHP | ImagickDraw bezier() Function
- PHP | ImagickDraw rectangle() Function
- PHP | ImagickDraw line() Function
- PHP | ImagickDraw skewX() Function
- PHP | ImagickDraw setStrokeWidth() Function
- PHP | ImagickDraw translate() Function
- PHP | ImagickDraw setStrokeOpacity() Function
- PHP | ImagickDraw setGravity() Function
- PHP | ImagickDraw setFillColor() Function
- PHP | ImagickDraw setFont() Function
- PHP | ImagickDraw setFontStyle() Function
- PHP | ImagickDraw setFontSize() Function
- PHP | ImagickDraw setFontWeight() Function
- PHP | ImagickDraw setStrokeMiterLimit() Function
- PHP | ImagickDraw setFillOpacity() 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.

