Complete collection of PHP GD library functions (collection)
Share the commonly used functions in the php gd library, with Chinese comments and classification processing, including image information, new/loading images, output images and other php gd library functions. Friends in need can refer to them.
Contents of this section: A complete list of functions of the php gd library. 1. Image information: gd_info: Get information about the currently installed GD library imagetypes returns the image types supported by the current PHP version image_type_to_extension gets the file suffix of the image type image_type_to_mime_type gets the MIME type of the image type getimagesize Get image size imagesx gets image width imagesy gets image height imageistruecolor checks whether the image is a true color image2. Create new/load image: imagecreate — Create a new palette-based image imagecreatefromgd2 — Create a new image from a GD2 file or URL imagecreatefromgd2part — Create a new image from a part of the given GD2 file or URL imagecreatefromgd — Create a new image from a GD file or URL imagecreatefromgif — Create a new image from a GIF file or URL imagecreatefromjpeg — Create a new image from a JPEG file or URL imagecreatefrompng — Create a new image from a PNG file or URL imagecreatefromstring — Create an image from an image stream in a string imagecreatefromwbmp — Create a new image from a WBMP file or URL imagecreatefromxbm — Create a new image from an XBM file or URL imagecreatefromxpm — Create a new image from an XPM file or URL imagecreatetruecolor — Create a new true color image3, output image: image2wbmp Outputs images in WBMP format to a browser or file imagegd2 Output GD2 images to a browser or file imagegd Output GD images to a browser or file imagegif Outputs an image in GIF format to a browser or file imagewbmp Outputs images in WBMP format to a browser or file imagexbm outputs XBM images to a browser or file imagejpeg Outputs an image in JPEG format to a browser or file imagepng Outputs an image in PNG format to a browser or file4, Miscellaneous related: imagealphablending sets the color blending mode of the image imageantialias Whether to use the anti-aliasing (antialias) function imageinterlace Activate or disable interlacing imagegammacorrect applies gamma correction to GD images iptcembed embeds binary IPTC data into a JPEG image iptcparse parses binary IPTC http://www.iptc.org/ chunks into individual tokens imagesavealpha Set flag to save full alpha channel information when saving PNG images (as opposed to a single transparent color)5, graphics related: imagearc draws elliptical arc imageconvolution uses coefficients div and offset to apply for a 3x3 convolution matrix imagedashedline draw a dotted line imageellipse draws an ellipse imagerectangle draws a rectangle imagefilledarc draws an elliptical arc and fills it imagefilledellipse draws an ellipse and fills it imagefilledpolygon draws a polygon and fills it imagefilledrectangle draws a rectangle and fills it imagesetbrush sets the brush image used for drawing lines imagesetpixel draws a single pixel imagesetstyle sets the style of line drawing imagesethickness sets the width of the line drawing imagepolygon draws a polygon imageline draws a line segment6, character/font related: imagechar draws a character horizontally imagecharup draws a character vertically imagestring draws a line of string horizontally imagestringup draws a line of string vertically imagepsbbox gives a text box using PostScript Type1 font imagepsencodefont changes the character encoding vector in the font imagepsextendfont expands or condenses fonts imagepsfreefont Frees the memory occupied by a PostScript Type 1 font imagepsloadfont loads a PostScript Type 1 font from a file imagepsslantfont tilts a font imagepstext draws text strings on images using PostScript Type1 fonts imagettfbbox Gets the range of text using TrueType fonts imagettftext writes text to an image using TrueType fonts imageftbbox gives a text box using FreeType 2 fonts imagefttext Write text to an image using FreeType 2 fonts imagefontheight gets the font height imagefontwidth gets the font width imageloadfont loads a new font7, color related: imagecolorallocate assigns a color to an image imagecolorallocatealpha assigns color + alpha to an image imagecolorat gets the color index value of a pixel imagecolorclosest Gets the index value of the color closest to the specified color. Gets the color index value of a certain pixel. imagecolorclosestalpha Gets the color closest to the specified color plus transparency imagecolorclosesthwb Gets the black and white index of the hue closest to the given color imagecolordeallocate cancels the allocation of image color imagecolorexact gets the index value of the specified color imagecolorexactalpha Gets the index value of the specified color plus transparency imagecolormatch makes the palette version of colors in an image more closely match the true color version imagepalettecopy copies a palette from one image to another imagecolorresolve Gets the index value of the specified color or the closest possible replacement value imagecolorresolvealpha Gets the index value of the specified color + alpha or the closest alternative possible imagecolorset sets the color for the specified palette index imagecolorsforindex gets the color of an index imagecolorstotal Gets the number of colors in the palette of an image imagecolortransparent defines a color as transparent8, Image operation: imagecopy copies part of an image imagecopymerge copies and merges part of an image imagecopymergegray copies and merges part of an image in grayscale imagecopyresampled resamples copy part of the image and resizes it imagecopyresized copies part of the image and resizes it imagerotate rotates an image by a given angle jpeg2wbmp Converts JPEG image files to WBMP image files png2wbmp Converts PNG image files to WBMP image files imagedestroy destroys an image1 2 Next Page Last Page |

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics

Alipay PHP...

Session hijacking can be achieved through the following steps: 1. Obtain the session ID, 2. Use the session ID, 3. Keep the session active. The methods to prevent session hijacking in PHP include: 1. Use the session_regenerate_id() function to regenerate the session ID, 2. Store session data through the database, 3. Ensure that all session data is transmitted through HTTPS.

JWT is an open standard based on JSON, used to securely transmit information between parties, mainly for identity authentication and information exchange. 1. JWT consists of three parts: Header, Payload and Signature. 2. The working principle of JWT includes three steps: generating JWT, verifying JWT and parsing Payload. 3. When using JWT for authentication in PHP, JWT can be generated and verified, and user role and permission information can be included in advanced usage. 4. Common errors include signature verification failure, token expiration, and payload oversized. Debugging skills include using debugging tools and logging. 5. Performance optimization and best practices include using appropriate signature algorithms, setting validity periods reasonably,

How to debug CLI mode in PHPStorm? When developing with PHPStorm, sometimes we need to debug PHP in command line interface (CLI) mode...

The application of SOLID principle in PHP development includes: 1. Single responsibility principle (SRP): Each class is responsible for only one function. 2. Open and close principle (OCP): Changes are achieved through extension rather than modification. 3. Lisch's Substitution Principle (LSP): Subclasses can replace base classes without affecting program accuracy. 4. Interface isolation principle (ISP): Use fine-grained interfaces to avoid dependencies and unused methods. 5. Dependency inversion principle (DIP): High and low-level modules rely on abstraction and are implemented through dependency injection.

How to automatically set the permissions of unixsocket after the system restarts. Every time the system restarts, we need to execute the following command to modify the permissions of unixsocket: sudo...

Sending JSON data using PHP's cURL library In PHP development, it is often necessary to interact with external APIs. One of the common ways is to use cURL library to send POST�...

Static binding (static::) implements late static binding (LSB) in PHP, allowing calling classes to be referenced in static contexts rather than defining classes. 1) The parsing process is performed at runtime, 2) Look up the call class in the inheritance relationship, 3) It may bring performance overhead.
