Skip to content
geeksforgeeks
  • Courses
    • DSA to Development
    • Get IBM Certification
    • Newly Launched!
      • Master Django Framework
      • Become AWS Certified
    • For Working Professionals
      • Interview 101: DSA & System Design
      • Data Science Training Program
      • JAVA Backend Development (Live)
      • DevOps Engineering (LIVE)
      • Data Structures & Algorithms in Python
    • For Students
      • Placement Preparation Course
      • Data Science (Live)
      • Data Structure & Algorithm-Self Paced (C++/JAVA)
      • Master Competitive Programming (Live)
      • Full Stack Development with React & Node JS (Live)
    • Full Stack Development
    • Data Science Program
    • All Courses
  • Tutorials
    • Data Structures & Algorithms
    • ML & Data Science
    • Interview Corner
    • Programming Languages
    • Web Development
    • CS Subjects
    • DevOps And Linux
    • School Learning
  • Practice
    • Build your AI Agent
    • GfG 160
    • Problem of the Day
    • Practice Coding Problems
    • GfG SDE Sheet
  • Contests
    • Accenture Hackathon (Ending Soon!)
    • GfG Weekly [Rated Contest]
    • Job-A-Thon Hiring Challenge
    • All Contests and Events
  • PHP Tutorial
  • PHP Exercises
  • PHP Array
  • PHP String
  • PHP Calendar
  • PHP Filesystem
  • PHP Math
  • PHP Programs
  • PHP Array Programs
  • PHP String Programs
  • PHP Interview Questions
  • PHP GMP
  • PHP IntlChar
  • PHP Image Processing
  • PHP DsSet
  • PHP DsMap
  • PHP Formatter
  • Web Technology
Open In App
Next Article:
PHP | Imagick borderImage() Function
Next article icon

PHP | Imagick drawImage() Function

Last Updated : 26 Jul, 2019
Comments
Improve
Suggest changes
Like Article
Like
Report
The Imagick::drawImage() function is an inbuilt function in PHP which is used to render the ImagickDraw object on the Imagick object. It is used to draw the image on the Imagick instance. We set an image matrix, parameters and the borders of the drawn image with the help of ImagickDraw methods and then render it using Imagick::drawImage() function. Syntax:
bool Imagick::drawImage( ImagickDraw $draw )
Parameters: This function accepts single parameter $draw which holds the ImagickDraw instance to get the details about the image that is to be rendered on the screen. Return Value: It returns True value when it is executed successfully. Program: This program creates an image, set its dimensions and border properties and then render it on the screen. PHP
<?php   // Declare a string which to be drawn  $geek = "GeeksforGeeks";   // Declare an Imagick object $image = new Imagick();  // Declare an ImagickDraw object $draw = new ImagickDraw();   // Set the color of Imagickdraw object $draw->setFillColor(new ImagickPixel('Green'));   // Set the font size of text $draw->setFontSize(120);   // Array representing the font metrics $metrix = $image->queryFontMetrics($draw, $geek);   // Set the position of text with respect // to the border  $draw->annotation(0, 100, $geek);   // Create image of given size $image->newImage(875, 150, new ImagickPixel('white'));   // Use drawImage() function to draw the image $image->drawImage($draw);   // Set the border of image $image->borderImage(new ImagickPixel('green'), 5, 5);   // Set the image format $image->setImageFormat('png');   header('Content-type: image/png');  // Display the image echo $image;  ?> 
Output: Reference: https://www.php.net/manual/en/imagick.drawimage.php

Next Article
PHP | Imagick borderImage() Function
author
piyush25pv
Improve
Article Tags :
  • Web Technologies
  • PHP
  • PHP-function
  • PHP-Imagick

Similar Reads

  • PHP | Gmagick drawimage() Function
    The Gmagick::drawimage() function is an inbuilt function in PHP which is used to render the GmagickDraw object on the current image. Syntax: Gmagick Gmagick::drawimage ( $GmagickDraw )   Parameters: This function accepts a single parameters as $GmagickDraw which stores the operations to render the i
    2 min read
  • PHP | Imagick addImage() Function
    The Imagick::addImage() function is an inbuilt function in PHP which is used to adds new image to Imagick object image list. After the operation iterator position is moved at the end of the list. This function adds new image to Imagick object from the current position of the source object. The Imagi
    1 min read
  • PHP | Imagick frameImage() Function
    The Imagick::frameImage() function is an inbuilt function in PHP which is used to add a three-dimensional border around the image. Syntax: bool Imagick::frameImage( $color, $width, $height, $inner_bevel, $outer_bevel ) Parameters: This function accepts five parameters as mentioned above and describe
    2 min read
  • PHP | Imagick cropImage() Function
    The Imagick::cropImage() function is an inbuilt function in PHP which is used to extracts the region of the image.Syntax:   int Imagick::cropImage( $width, $height, $x, $y ) Parameters: This function accept four parameters as mention above and describe below.   $width: This parameter is used to spec
    2 min read
  • PHP | Imagick borderImage() Function
    The Imagick::borderImage() function is an inbuilt function in PHP which is used to draw the border in an image. This function creates the border surrounded to the image in the given color. Syntax: bool Imagick::borderImage( $bordercolor, $width, $height ) Parameters: This function accepts three para
    1 min read
  • PHP | Imagick edgeImage() Function
    The Imagick::edgeImage() function is an inbuilt function in PHP which is used to enhance the edges within the image. It enhances the edges with the help of a convolution filter of the given radius. Syntax: bool Imagick::edgeImage( $radius ) Parameters: This function accepts single parameter $radius
    1 min read
  • PHP | Imagick displayImage() Function
    The Imagick::displayImage() function is an inbuilt function in PHP which is used to displays an image object. Syntax: bool Imagick::displayImage( $servername ) Parameters: This function accepts a single parameter $servername which is used to specify the server name. Return Value: This function retur
    1 min read
  • PHP | Imagick displayImages() Function
    The Imagick::displayImages() function is an inbuilt function in PHP which is used to display an image or images sequence on an X server. Syntax: bool Imagick::displayImages( string $servername ) Parameters: This function accepts single parameter $servername which holds the X server name. Return Valu
    1 min read
  • PHP | Imagick averageImages() Function
    The Imagick::averageImages() function is an inbuilt function in PHP which is used to create an average of two or more images after image processing. It is well defined in PECL imagick 2.0.0 version. This function has been depreciated in further versions of Imagick hence it is replaced by Imagick::me
    2 min read
  • PHP | Imagick charcoalImage() Function
    The Imagick::charcoalImage() function is an inbuilt function in PHP which is used to simulate a charcoal drawing of an image. Syntax: bool Imagick::charcoalImage( $radius, $sigma ) Parameters: This function accepts two parameters as mentioned above and described below: $radius: This parameter stores
    1 min read
geeksforgeeks-footer-logo
Corporate & Communications Address:
A-143, 7th Floor, Sovereign Corporate Tower, Sector- 136, Noida, Uttar Pradesh (201305)
Registered Address:
K 061, Tower K, Gulshan Vivante Apartment, Sector 137, Noida, Gautam Buddh Nagar, Uttar Pradesh, 201305
GFG App on Play Store GFG App on App Store
Advertise with us
  • Company
  • About Us
  • Legal
  • Privacy Policy
  • In Media
  • Contact Us
  • Advertise with us
  • GFG Corporate Solution
  • Placement Training Program
  • Languages
  • Python
  • Java
  • C++
  • PHP
  • GoLang
  • SQL
  • R Language
  • Android Tutorial
  • Tutorials Archive
  • DSA
  • Data Structures
  • Algorithms
  • DSA for Beginners
  • Basic DSA Problems
  • DSA Roadmap
  • Top 100 DSA Interview Problems
  • DSA Roadmap by Sandeep Jain
  • All Cheat Sheets
  • Data Science & ML
  • Data Science With Python
  • Data Science For Beginner
  • Machine Learning
  • ML Maths
  • Data Visualisation
  • Pandas
  • NumPy
  • NLP
  • Deep Learning
  • Web Technologies
  • HTML
  • CSS
  • JavaScript
  • TypeScript
  • ReactJS
  • NextJS
  • Bootstrap
  • Web Design
  • Python Tutorial
  • Python Programming Examples
  • Python Projects
  • Python Tkinter
  • Python Web Scraping
  • OpenCV Tutorial
  • Python Interview Question
  • Django
  • Computer Science
  • Operating Systems
  • Computer Network
  • Database Management System
  • Software Engineering
  • Digital Logic Design
  • Engineering Maths
  • Software Development
  • Software Testing
  • DevOps
  • Git
  • Linux
  • AWS
  • Docker
  • Kubernetes
  • Azure
  • GCP
  • DevOps Roadmap
  • System Design
  • High Level Design
  • Low Level Design
  • UML Diagrams
  • Interview Guide
  • Design Patterns
  • OOAD
  • System Design Bootcamp
  • Interview Questions
  • Inteview Preparation
  • Competitive Programming
  • Top DS or Algo for CP
  • Company-Wise Recruitment Process
  • Company-Wise Preparation
  • Aptitude Preparation
  • Puzzles
  • School Subjects
  • Mathematics
  • Physics
  • Chemistry
  • Biology
  • Social Science
  • English Grammar
  • Commerce
  • World GK
  • GeeksforGeeks Videos
  • DSA
  • Python
  • Java
  • C++
  • Web Development
  • Data Science
  • CS Subjects
@GeeksforGeeks, Sanchhaya Education Private Limited, All rights reserved
We use cookies to ensure you have the best browsing experience on our website. By using our site, you acknowledge that you have read and understood our Cookie Policy & Privacy Policy
Lightbox
Improvement
Suggest Changes
Help us improve. Share your suggestions to enhance the article. Contribute your expertise and make a difference in the GeeksforGeeks portal.
geeksforgeeks-suggest-icon
Create Improvement
Enhance the article with your expertise. Contribute to the GeeksforGeeks community and help create better learning resources for all.
geeksforgeeks-improvement-icon
Suggest Changes
min 4 words, max Words Limit:1000

Thank You!

Your suggestions are valuable to us.

What kind of Experience do you want to share?

Interview Experiences
Admission Experiences
Career Journeys
Work Experiences
Campus Experiences
Competitive Exam Experiences