Apply 3x3 Convolution Matrix Using ImageConvolution in PHP

Urmila Samariya
Updated on 09-Aug-2021 13:52:32

257 Views

imageconvolution() is an inbuilt function in PHP that is used to apply a 3×3 convolution matrix, using the coefficient and offset in the image.Syntaxbool imageconvolution ( $image, $matrix, $div, $offset)Parametersimageconvolution() takes four parameters: $image, $matrix, $div, and $offset.$image − This parameter is used to create the size of the image by using an image creation function such as imagecreatetruecolor().$matrix − This parameter contains an array of 3×3 matrix of floats.$div − It is used for normalization.$offset − This parameter is used to set the color offset.Return Valuesimageconvolution() returns True on success and False on failure.Example 1OutputInput PNG image before using ... Read More

Apply Gamma Correction to GD Image in PHP

Urmila Samariya
Updated on 09-Aug-2021 13:48:58

212 Views

imagegammacorrect() is an inbuilt function in PHP that is used to apply a gamma correction to a given Graphics Draw (GD) input image and an output gamma.Syntaxbool imagegammacorrect(resource $image, float $inputgamma, float $outputgamma)Parametersimagegammacorrect() takes three different parameters: $image, $inputgamma and $outputgamma.$image − Specifies the image to be worked.$inputgamma − Specifies the input gamma.$outputgamma − Specifies the output gamma.Return Valuesimagegammacorrect() returns True on success and False on failure.Example 1OutputInput image before using imagegammacorrect() PHP functionOutput image after using imagegammacorrect() PHP functionExplanation − In this example, we loaded the image from the local drive folder by using the imagecreatefrompng() function or we ... Read More

Enable or Disable Interlace Using imageinterlace Function in PHP

Urmila Samariya
Updated on 09-Aug-2021 13:44:39

503 Views

imageinterlace() is an inbuilt PHP function that is used to enable or disable interlace in an image. It is a method of encoding a bitmap image such that a person who has partially received it sees a degraded copy of the entire image.Interlacing an image lets users see portions of it as it loads, and it takes different forms depending on the image type. The non-interlaced JPEGs appear line-by-line. To enable interlacing on picture, we can simply call this function with the second parameter set to 1, or set to 0 (zero) to disable it.Syntaxint imageinterlace(resource $image, int $interlace)Parametersimageinterlace() takes ... Read More

Set a Single Pixel Using imagesetpixel Function in PHP

Urmila Samariya
Updated on 09-Aug-2021 13:39:33

491 Views

imagesetpixel() is an inbuilt function in PHP that is used to set a single pixel at the listed coordinate.Syntaxbool imagesetpixel(resource $image, int $x, int $y, int $color)Parametersimagesetpixel() accepts four parameters: $image, $x, $y and $color.$image − Specifies the image resource to work on.$x − Specifies the x-coordinate of the pixel.$y − Specifies the y-coordinate of the pixel.$color − Specifies the color of the pixel.Return Values −imagesetpixel() returns True on success and False on failure.Example 1OutputExample 2Output

Set Image Thickness for Line Drawing in PHP Using imgesetthickness

Urmila Samariya
Updated on 09-Aug-2021 13:21:29

357 Views

imagesetthickness() is an inbuilt function in PHP that is used to set the thickness for line drawing.Syntaxbool imagesetthickness($image, $thickness)Parametersimagesetthickness() 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 in pixel.Return Valuesimagesetthickness() returns True on success and False on failure.Example 1OutputExample 2Output

Draw String Vertically Using imageStringUp Function in PHP

Urmila Samariya
Updated on 09-Aug-2021 13:16:36

415 Views

imagestringup() is an inbuilt function in PHP that is used to draw an image vertically.Syntaxbool imagestringup ($image, $font, $x, $y, $string, $color)Parametersimagestring() accepts six parameters: $image, $font, $x, $y, $string, and $color.$image − The $image parameter uses imagecreatetruecolor() function to create a blank image of given size.$font − The $font parameter is used to set the font-size values from 1, 2, 3, 4, and 5 for inbuilt fonts or other font identifiers registered with imageloadfont() function.$x − Holds the position of the font in the horizontal X-axis, upper leftmost corner.$y − Holds the position of the font in the vertical ... Read More

Draw Text String Image Horizontally Using imageString Function in PHP

Urmila Samariya
Updated on 09-Aug-2021 13:13:31

955 Views

imagestring() is an inbuilt function in PHP that is used to draw a string horizontally.Syntaxbool imagestring($image, $font, $x, $y, $string, $color)Parametersimagestring() accepts six different parameters − $image, $font, $x, $y, $string, and $color.$image − The $image parameter uses imagecreatetruecolor() function to create a blank image in the given size.$font − The $font parameter is used to set the font size values from 1, 2, 3, 4, and 5 for inbuilt fonts.$x − Holds the position of the font in the horizontal X-axis, upper leftmost corner.$y − Holds the position of the font in the vertical Y-axis, topmost corner.$string − The ... Read More

Set Tile Image for Filling using imageSetTile Function in PHP

Urmila Samariya
Updated on 09-Aug-2021 13:10:16

398 Views

imagesettle() is an inbuilt function in PHP that is used to set the tile image for filling. It sets the image to be used by all-region filling functions like imagefill() and imagefilledpolygon() when filling with a special color IMG_COLOR_TILED.We can say that a tile is an image that is used to fill an area with a repeated pattern. We can use any GD image as a tile.Syntaxbool imagesettile($image, $tile)Parametersimagesettile() takes two parameters: $image and $tile.$image − Holds a GD image.$tile − The $tile parameter is used to set the image resource as a tile.Return Valuesimagesettile() returns True on success and ... Read More

Set Style for Line Drawing Using imagesetstyle Function in PHP

Urmila Samariya
Updated on 09-Aug-2021 13:06:26

203 Views

imagesetstyle() is an inbuilt function in PHP that is used to set the style for line drawing. It can be used by all line drawing functions like imagepolygon or imageline.Syntaxbool imagesetstyle(resource $image, array $style)Parametersimagesetstyle() takes two parameters: $image and $style.$image − Specifies the image resource to work on.$style − Specifies the array of pixel colors.Return Valuesimagesetstyle() returns True on success or False on failure.Example 1Input ImageOutput ImageExample 2Output

Rotate Image with Given Angle Using imagerotate Function in PHP

Urmila Samariya
Updated on 09-Aug-2021 13:02:24

1K+ Views

imagerotate() is an inbuilt function in PHP that is used to rotate an image with a given angle in degrees.Syntaxresource imagerotate($image, $angle, $bgd_color, $ignore_transparent = 0)Parametersimagerotate() accepts four parameters, $image, $angle, $bgd_color, and $ignore_transparent.$image − The $image parameter returned by the imagecreatetruecolor() function. It is used to create the size of an image.$angle − The $angle parameter is used to hold the different rotation angles in degrees. It is used to rotate an image in the anticlockwise direction.$bgd_color − Holds the background color of the uncovered zone after the rotation.$ignore_transparent − The $ignore_transparent parameter is used to set and if ... Read More

Advertisements