PHP | GmagickDraw setstrokecolor() Function Last Updated : 28 Jan, 2019 Comments Improve Suggest changes Like Article Like Report The GmagickDraw ::setstrokecolor() function is an inbuilt function in PHP which is used to set the color used for stroking object outlines. Syntax: public GmagickDraw::setstrokecolor( $color ) : GmagickDraw Parameters: This function accepts single parameter $color which is used to hold the color value. Return Value: This function returns the GmagickDraw object on success. Below programs illustrates the GmagickDraw ::setstrokecolor() function in PHP: Program 1: php <?php // require_once('path/vendor/autoload.php'); // Create an GmagickDraw object $draw = new \GmagickDraw (); // Set stroke opacity $draw->setStrokeOpacity(1); // Set stroke color $draw->setStrokeColor('Black'); // Set stroke opacity $draw->setStrokeOpacity(0.8); // Set stroke width $draw->setStrokeWidth(10); // Set Stroke Line Join $draw->setStrokeLineJoin(Gmagick::LINEJOIN_ROUND); // Set Fill Color $draw->setFillColor('lightgreen'); // Set Stroke Miter Limit $draw->setStrokeMiterLimit(40 * 12); $points = [ ['x' => 50 * 6, 'y' => 10 * 5], ['x' => 20 * 7, 'y' => 30 * 5], ['x' => 60 * 8, 'y' => 50 * 5], ['x' => 70 * 3, 'y' => 15 * 5], ]; // Draw a polygon $draw->polygon($points); // Create a new Gmagick object $image = new \Gmagick(); // Set image dimensions $image->newImage(500, 300, 'white'); // Set the image format $image->setImageFormat("png"); // Draw the image $image->drawImage($draw); header("Content-Type: image/png"); // Display the image echo $image->getImageBlob(); ?> Output: Program 2: php <?php // require_once('path/vendor/autoload.php'); // Create an GmagickDraw object $draw = new \GmagickDraw (); // Set the stroke color $draw->setStrokeColor('Green'); // Set Fill Color $draw->setFillColor('Red'); // Set the stroke width $draw->setStrokeWidth(7); // Draw the rectangle $draw->rectangle(40, 30, 200, 260); // Create new Gmagick object $image = new \Gmagick(); // Set the image dimension $image->newImage(300, 300, 'White'); // Set the image format $image->setImageFormat("png"); // Draw the image $image->drawImage($draw); header("Content-Type: image/png"); // Display the image echo $image->getImageBlob(); ?> Output: Reference: http://php.net/manual/en/gmagickdraw.setstrokecolor.php Comment More infoAdvertise with us Next Article Must Do Coding Questions Company-wise R R_Raj Follow Improve Article Tags : Web Technologies PHP Image-Processing PHP-function PHP-Gmagick +1 More Similar Reads Interview Preparation Interview Preparation For Software Developers Must Coding Questions - Company-wise Must Do Coding Questions - Topic-wise Company-wise Practice Problems Company Preparation Competitive Programming Software Design-Patterns Company-wise Interview Experience Experienced - Interview Experiences Internship - Interview Experiences Practice @Geeksforgeeks Problem of the Day Topic-wise Practice Difficulty Level - School Difficulty Level - Basic Difficulty Level - Easy Difficulty Level - Medium Difficulty Level - Hard Leaderboard !! Explore More... Data Structures Arrays Linked List Stack Queue Binary Tree Binary Search Tree Heap Hashing Graph Advance Data Structures Matrix String All Data Structures Algorithms Analysis of Algorithms Searching Algorithms Sorting Algorithms Pattern Searching Geometric Algorithms Mathematical Algorithms Randomized Algorithms Greedy Algorithms Dynamic Programming Divide & Conquer Backtracking Branch & Bound All Algorithms Programming Languages C C++ Java Python C# Go Lang SQL PHP Scala Perl Kotlin Web Technologies HTML CSS JavaScript Bootstrap Tailwind CSS AngularJS ReactJS jQuery NodeJS PHP Web Design Web Browser File Formats Computer Science Subjects Operating Systems DBMS Computer Network Computer Organization & Architecture TOC Compiler Design Digital Elec. & Logic Design Software Engineering Engineering Mathematics Data Science & ML Complete Data Science Course Data Science Tutorial Machine Learning Tutorial Deep Learning Tutorial NLP Tutorial Machine Learning Projects Data Analysis Tutorial Tutorial Library Python Tutorial Django Tutorial Pandas Tutorial Kivy Tutorial Tkinter Tutorial OpenCV Tutorial Selenium Tutorial GATE CS GATE CS Notes Gate Corner Previous Year GATE Papers Last Minute Notes (LMNs) Important Topic For GATE CS GATE Course Previous Year Paper: CS exams Like