PHP Articles

Page 29 of 81

imagecolorat() function in PHP

Arjun Thakur
Arjun Thakur
Updated on 11-Mar-2026 370 Views

The imagecolorat() function gets the index of the color of the pixel.Syntaximagecolorat( $img, $x, $y )Parametersimg: Create an image with imagecreatetruecolor() function.x: The x-coordinate of the point.y: The y-coordinate of the point.ReturnThe imagecolorat() function returns the color index or FALSE on failure.ExampleThe following is an example:OutputThe following is the output:array(4) { ["red"]=> int(255) ["green"]=> int(255) ["blue"]=> int(255) ["alpha"]=> int(127) }

Read More

imagesy() function in PHP

George John
George John
Updated on 11-Mar-2026 131 Views

The imagesy() function gets the height of image. It returns the height of the image or FALSE on errors.Syntaximagesy(img)Parametersimg: Image resource created with imagecreatetruecolor()ReturnThe imagesy() function returns the height of the image or FALSE on errors.ExampleThe following is an example:OutputThe following is the output:250

Read More

imagesx() function in PHP

Ankith Reddy
Ankith Reddy
Updated on 11-Mar-2026 310 Views

The imagesx() function gets the width of image. It returns the width of the image or FALSE on errors.Syntaximagesx(img)Parametersimg: Image resource created with imagecreatetruecolor()ReturnThe imagesx() function returns the width of the image or FALSE on errors.ExampleThe following is an example:OutputThe following is the output:450

Read More

imagecolorclosestalpha() function in PHP

Ankith Reddy
Ankith Reddy
Updated on 11-Mar-2026 103 Views

The imagecolorclosestalpha() function gets the index of closet color with alpha value.Syntaximagecolorclosestalpha ( img, red, green, blue, alpha )Parametersimg: Image resource created with imagecreatetruecolor().red: Red color componentgreen: Green color componentblue: Blue color componentalpha: The transparency of image, with 0 indicating completely opaque, whereas 127 indicating completely transparent.ReturnThe imagecolorclosestalpha() function returns the index of the closest color in the palette.ExampleThe following is an example:

Read More

imagecolorclosesthwb() function in PHP

George John
George John
Updated on 11-Mar-2026 82 Views

The imagecolorclosesthwb() function gets the index of the color which has the hue, white and blacknessSyntaximagecolorclosesthwb ( $img, $red, $green, $blue )Parametersimg: Create image with imagecreatetruecolor()red: Red color componentgreen: Green color componentblue: Blue color componentReturnThe imagecolorclosesthwb() function returns an integer with the index of the color which has the hue, white and blackness nearest the given color.ExampleThe following is an example:OutputThe following is the output:HWB = 87

Read More

imagecolorexact() function in PHP

Arjun Thakur
Arjun Thakur
Updated on 11-Mar-2026 104 Views

The imagecolorexact() function gets the index of the specified color.Syntaximagecolorexact ( $img, $red, $green, $blue )Parametersimg: Image resource created with imagecreatetruecolor().red: Red color componentgreen: Green color componentblue: Blue color componentReturnThe imagecolorexact() function returns the index of the specified color in the palette, or -1 if the color does not exist.ExampleThe following is an example:OutputThe following is the output:Array ( [0] => 1989170 [1] => 5273700 [2] => 1658930 )

Read More

imagecolorclosest() function in PHP

George John
George John
Updated on 11-Mar-2026 128 Views

The imagecolorclosest() function gets the index of the closest color to the specified color.Syntaximagecolorallocatealpha (img, red, green, blue)Parametersimg: Image resource created with imagecreatetruecolor().red: Red color componentgreen: Green color componentblue: Blue color componentReturnThe imagecolorclosest() function returns the index of the closest color, in the palette of the image.ExampleThe following is an example:

Read More

imagecolorresolvealpha() function in PHP

Arjun Thakur
Arjun Thakur
Updated on 11-Mar-2026 70 Views

The imagecolorresolvealpha() function is used to get the index of the specified color with alpha.Syntaximagecolorresolvealpha (img , red , green , blue , alpha )Parametersimg: Creates an image with imagecreatetruecolor().red: The red componentgreen: The green componentblue: The blue componentalpha: Value between 0 and 127. 0 indicates completely opaque while 127 indicates completely transparent.ReturnThe imagecolorresolvealpha() function returns the color index.ExampleThe following is an exampleOutputThe following is the output:Array ( [0] => 128 [1] => 129 [2] => 130 )

Read More

imagecolorsforindex() function in PHP

George John
George John
Updated on 11-Mar-2026 124 Views

The imagecolorsforindex() function gets the colors for an index.Syntaximagecolorsforindex ( img, index )Parametersimg: Creates an image with imagecreatetruecolor()Index: Set the color index.ReturnThe imagecolorsforindex() function returns an associative array with red, green, blue and alpha keys that contain the appropriate values for the specified color index.ExampleThe following is an exampleOutputThe following is the output:array(4) { ["red"]=> int(255) ["green"]=> int(255) ["blue"]=> int(255) ["alpha"]=> int(127) }

Read More

imagecolorstotal() function in PHP

Chandu yadav
Chandu yadav
Updated on 11-Mar-2026 95 Views

The imagecolorstotal() function gets the count of colors in an image's paletteSyntaximagecolorstotal (img)Parametersimg: Image created with imagecreatetruecolor().ReturnThe imagecolorstotal() function returns the number of colors in an image palette.ExampleThe following is an exampleOutputThe following is the output:Number of Colors = 128

Read More
Showing 281–290 of 801 articles
« Prev 1 27 28 29 30 31 81 Next »
Advertisements