PHP | imagesetthickness() Function Last Updated : 26 Aug, 2019 Comments Improve Suggest changes Like Article Like Report The imagesetthickness() function is an inbuilt function in PHP which is used to set the thickness for line drawing. Syntax: bool imagesetthickness( $image, $thickness ) Parameters: This function accepts two parameters as mentioned above and described below: $image: It is returned by one of the image creation functions, such as imagecreatetruecolor(). It is used to create size of image. $thickness: This parameter is used to set the thickness in pixel. Return Value: This function returns True on success or False on failure. Below programs illustrate the imagesetthickness() function in PHP: Program 1: php <?php // Create an image of given size $im = imagecreatetruecolor(400, 300); $green = imagecolorallocate($im, 0, 153, 0); $white = imagecolorallocate($im, 0xff, 0xff, 0xff); // Set the background to be white imagefilledrectangle($im, 0, 0, 400, 300, $green); // Set the line thickness to 5 imagesetthickness($im, 5); // Draw the rectangle imagerectangle($im, 50, 50, 350, 250, $white); // Output image to the browser header('Content-Type: image/png'); imagepng($im); imagedestroy($im); ?> Output: Program 2: php <?php // Create an image of given size $im = imagecreatetruecolor(400, 100); $green = imagecolorallocate($im, 0, 153, 0); $white = imagecolorallocate($im, 0xff, 0xff, 0xff); // Set the background to be white imagefilledrectangle($im, 0, 0, 400, 300, $green); // Set the line thickness to 15 imagesetthickness($im, 15); // Draw the line imageline($im, 50, 50, 350, 50, $white); // Output image to the browser header('Content-Type: image/png'); imagepng($im); imagedestroy($im); ?> Output: Reference: http://php.net/manual/en/function.imagesetthickness.php Comment More infoAdvertise with us Next Article PHP | imagesetthickness() Function V vijay_raj Follow Improve Article Tags : Web Technologies PHP Image-Processing PHP-function Similar Reads PHP | imagesettile() Function The imagesettile() function is an inbuilt function in PHP which is used to set the tile image for filling the area. Syntax: bool imagesettile( $image, $tile ) Parameters: This function accepts two parameters as mentioned above and described below: $image: It is returned by one of the image creation 2 min read PHP | imagetypes() Function The imagetypes() function is an inbuilt function in PHP which is used to return the image types supported by the PHP inbuilt installed library. Syntax: int imagetypes( void ) Parameters: This function does not accept any parameter. Return Value: This function returns the bit-field corresponding to t 1 min read PHP | getimagesize() Function The getimagesize() function in PHP is an inbuilt function which is used to get the size of an image. This function accepts the filename as a parameter and determines the image size and returns the dimensions with the file type and height/width of image. Syntax: array getimagesize( $filename, $image_ 2 min read PHP | imagepng() Function The imagepng() function is an inbuilt function in PHP which is used to display image to browser or file. The main use of this function is to view an image in the browser, convert any other image type to PNG and applying filters to the image. Syntax: bool imagepng( resource $image, int $to, int $qual 2 min read PHP | imagesetinterpolation() Function The imagesetinterpolation() function is an inbuilt function in PHP which is used to set the interpolation method, setting an interpolation method affects the rendering of various functions such as the imagerotate() function.Syntax:Â Â bool imagesetinterpolation( resource $image, int $method )Parameter 2 min read PHP | Imagick newImage() Function The Imagick::newImage() function is an inbuilt function in PHP which is used to creates a new image. This function creates a new image and associates ImagickPixel value as the background color. Syntax:Â bool Imagick::newImage( $cols, $rows, $background, $format ) Parameters: This function accepts fo 1 min read PHP | Imagick getImageLength() Function The Imagick::getImageLength() function is an inbuilt function in PHP which is used to get the length of an image object in bytes. Syntax: bool Imagick::getImageLength( void) Parameters: This function does not accept any parameter. Return Value: This function returns the image length in bytes. Below 1 min read PHP | imagejpeg() Function The imagejpeg() function is an inbuilt function in PHP which is used to display image to browser or file. The main use of this function is to view an image in the browser, convert any other image type to JPEG and altering the quality of the image. Syntax: bool imagejpeg( resource $image, int $to, in 2 min read PHP | imagewebp() Function The imagewebp() function is an inbuilt function in PHP which is used to display image to browser or file. The main use of this function is to view an image in the browser, convert any other image type to WebP and alter the quality of the image.Syntax:Â bool imagewebp( resource $image, int $to, int $q 2 min read PHP | Imagick getImageSize() Function The Imagick::getImageSize() function is an inbuilt function in PHP which is used to get the image length in bytes. Syntax: int Imagick::getImageSize( void ) Parameters: This function doesnât accepts any parameter. Return Value: This function returns an integer value containing the current image size 1 min read Like