Article Categories
- All Categories
-
Data Structure
-
Networking
-
RDBMS
-
Operating System
-
Java
-
MS Excel
-
iOS
-
HTML
-
CSS
-
Android
-
Python
-
C Programming
-
C++
-
C#
-
MongoDB
-
MySQL
-
Javascript
-
PHP
-
Economics & Finance
Articles by Urmila Samariya
Page 7 of 11
How to apply a gamma correction to a Graphics Draw (GD) image in PHP?
The imagegammacorrect() function is an inbuilt PHP function that applies gamma correction to a Graphics Draw (GD) image. Gamma correction adjusts the brightness and contrast of an image by modifying the relationship between input and output pixel values. Syntax bool imagegammacorrect(resource $image, float $inputgamma, float $outputgamma) Parameters The imagegammacorrect() function takes three parameters ? $image − The image resource to apply gamma correction to $inputgamma − The input gamma value (typically between 0.1 and 10.0) $outputgamma − The output gamma value (typically between 0.1 and 10.0) Return Values Returns ...
Read MoreHow to enable or disable interlace using imageinterlace() function in PHP?
The imageinterlace() function is a built-in PHP function used to enable or disable interlacing in images. Interlacing encodes bitmap images so that partially loaded images display as degraded copies of the entire image, allowing users to see portions as the image loads progressively. Non-interlaced JPEGs appear line-by-line during loading, while interlaced images show a blurred version that becomes clearer. This function controls this behavior by setting the interlace parameter to 1 (enable) or 0 (disable). Syntax int imageinterlace(resource $image, int $interlace) Parameters The imageinterlace() function accepts two parameters: ...
Read MoreHow to set a single pixel using imagesetpixel() function in PHP?
The imagesetpixel() function is an inbuilt PHP function used to set a single pixel at a specified coordinate in an image. It's part of the GD library extension and requires the image to be an image resource. Installation: Ensure the GD extension is enabled in your PHP installation. Most PHP installations include it by default. Syntax bool imagesetpixel(resource $image, int $x, int $y, int $color) Parameters The imagesetpixel() function accepts four parameters: $image − The image resource to work on, created by functions like imagecreate() or imagecreatefromjpeg(). $x − ...
Read MoreHow to set the image thickness for line drawing using imgesetthickness() function in PHP?
imagesetthickness() is an inbuilt function in PHP that is used to set the thickness for line drawing. Syntax bool imagesetthickness($image, $thickness) Parameters imagesetthickness() accepts two parameters − $image and $thickness. $image − This parameter is returned by an image creation function such as imagecreatetruecolor(). It is used to create the size of an image. $thickness − This parameter sets the thickness ...
Read MoreHow to draw a text string image horizontally by using imagestring() function in PHP?
The imagestring() function is a built-in PHP function used to draw a text string horizontally on an image. It requires the GD extension to be enabled for image manipulation. Installation: Ensure PHP GD extension is installed and enabled in your PHP configuration. Syntax bool imagestring($image, $font, $x, $y, $string, $color) Parameters The imagestring() function accepts six parameters − $image − An image resource created by functions like imagecreate() or imagecreatetruecolor(). $font − Font size ranging from 1 to 5 for built-in fonts (1 is smallest, 5 is largest). $x ...
Read MoreHow to set the tile image for filling using imagesettile() function in PHP?
The imagesettile() function is an inbuilt function in PHP that sets the tile image for filling operations. It defines the image to be used by all-region filling functions like imagefill() and imagefilledpolygon() when filling with the special color IMG_COLOR_TILED. A tile is an image that fills an area with a repeated pattern. Any GD image resource can be used as a tile to create seamless patterns across larger areas. Syntax bool imagesettile($image, $tile) Parameters imagesettile() accepts two parameters − $image − The image resource (canvas) where the tile will be applied ...
Read MoreHow to set the style for line drawing using imagesetstyle() function in PHP?
The imagesetstyle() function is an inbuilt PHP function used to set custom styles for line drawing. It works with all line drawing functions like imagepolygon() and imageline() to create dashed, dotted, or patterned lines. Syntax bool imagesetstyle(resource $image, array $style) Parameters imagesetstyle() takes two parameters − $image − The image resource to work on, created by functions like imagecreate() or imagecreatetruecolor(). $style − An array of pixel colors that defines the line pattern. Each element represents one pixel in the repeating pattern. Return Value Returns True on success or ...
Read MoreHow to rotate an image with a given angle using imagerotate() function in PHP?
The imagerotate() function is an inbuilt PHP function used to rotate an image by a specified angle in degrees. This function is part of the GD extension and provides a simple way to perform image rotation operations. Note: This function requires the GD extension to be enabled. Install it using: sudo apt-get install php-gd (Ubuntu/Debian) or enable it in php.ini by uncommenting extension=gd. Syntax resource imagerotate($image, $angle, $bgd_color, $ignore_transparent = 0) Parameters The imagerotate() function accepts four parameters ? $image − An image resource created by functions like imagecreatetruecolor(), ...
Read MoreHow to get or set the resolution of an image using imageresolution() function in PHP?
The imageresolution() function is an inbuilt PHP function that is used to get or set the resolution of an image in dots per inch (DPI). If no optional parameters are given, it returns the current resolution as an indexed array. If optional parameters are provided, it sets both the width and height resolution. The resolution is only used as meta information when images are read from and written to formats that support this information (currently PNG and JPEG). It does not affect drawing operations. The default resolution for new images is 96 DPI. Syntax mixed imageresolution(resource ...
Read MoreHow to copy the palette from one image to another using imagepalettecopy() function in PHP?
The imagepalettecopy() function is an inbuilt PHP function used to copy the color palette from one image resource to another. This function is particularly useful when working with palette-based images where you want to share the same color scheme between multiple images. Syntax void imagepalettecopy(resource $destination, resource $source) Parameters The imagepalettecopy() function accepts two parameters ? $destination − Specifies the destination image resource that will receive the copied palette. $source − Specifies the source image resource from which the palette will be copied. Return Value This function does not ...
Read More