Found 34489 Articles for Programming

imagecolorresolvealpha() function in PHP

Arjun Thakur
Updated on 31-Dec-2019 07:45:27

15 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 example Live DemoOutputThe following is the output:Array ( [0] => 128 [1] => 129 [2] => 130 )

imagecopymergegray() function in PHP

George John
Updated on 31-Dec-2019 07:44:46

31 Views

The imagecopymergegray() function is used to copy and merge part of an image with gray scale.Syntaximagecopymerge ( dst_img, src_img, dst_x, dst_y, src_x, src_y, src_w, src_h, pct )Parametersdst_im Set destination image link resource.src_im Set source image link resource.dst_xSet x-coordinate of destination point.dst_y Set y-coordinate of destination point.src_x Set x-coordinate of source point.src_y Set y-coordinate of source point.src_w Set source width.src_h Set source height.pct The src_im will be changed to grayscale according to pct where 0 is fully grayscale and 100 is unchanged.ReturnThe imagecopymergegray() function returns the TRUE on success or FALSE on failure.ExampleThe following is an example:OutputThe following is the output:ExampleLet us see another example wherein we have set ... Read More

imagecopy() function in PHP

Arjun Thakur
Updated on 31-Dec-2019 07:42:43

676 Views

The imagecopy() function is used to copy part of an image.Syntaximagecopy( dst_img, src_img, dst_x, dst_y, src_x, src_y, src_w, src_h)Parametersdst_im Set destination image link resource.src_im Set source image link resource.dst_x Set x-coordinate of destination point.dst_y Set y-coordinate of destination point.src_x Set x-coordinate of source point.src_y Set y-coordinate of source point.src_w Set source width.src_h Set source height.ReturnThe imagecopy() function returns TRUE on success or FALSE on failure.ExampleThe following is an example:OutputThe following is the output:ExampleLet us see another example wherein part of an image is copied:OutputThe following is the output:Read More

imagecopymerge() function in PHP

Chandu yadav
Updated on 31-Dec-2019 07:41:39

609 Views

The imagecopymerge() function copy and merge part of an image.Syntaximagecopymerge ( dst_img, src_img, dst_x, dst_y, src_x, src_y, src_w, src_h, pct )Parametersdst_im Set destination image link resource.src_im Set source image link resource.dst_x Set x-coordinate of destination point.dst_y Set y-coordinate of destination point.src_x Set x-coordinate of source point.src_y Set y-coordinate of source point.src_w Set source width.src_h Set source height.pct The two images will be merged according to pct which can range from 0 to 100.ReturnThe imagecopymerge() function returns the TRUE on success or FALSE on failure.ExampleThe following is an example:OutputThe following is the output displaying the merge of two images:ExampleLet us see ... Read More

imagecharup() function in PHP

Ankith Reddy
Updated on 31-Dec-2019 07:40:15

25 Views

The imagecharup() function is used to draw a character vertically.Syntaximagecharup( img, font, x, y, c, color )Parametersimg: Create an image with imagecreatetruecolor()font: Sets the font size. It can be 1, 2, 3, 4, 5 for built-in fonts in latin2 encodingx: x-coordinatey: y-coordinatec: character to be drawncolor: color identifierReturnThe imagecharup() function returns TRUE on success or FALSE on failure.ExampleThe following is an example:OutputThe following is the output:ExampleLet us see another example:OutputThe following is the output that draws character E with different dimensions:

imagechar() function in PHP

Chandu yadav
Updated on 31-Dec-2019 07:38:45

78 Views

The imagechar() function draws a character horizontally.Syntaxbool imagechar( img, font, x, y, ch, color )Parametersimg: Creating an image with imagecreatetruecolor().font: Set font sizex: x-coordinatey: y-coordinatec: The character to draw.color: A color identifier created with imagecolorallocate().ReturnThe imagechar() function returns TRUE on success or FALSE on failure.ExampleThe following is an example:OutputThe following is the output:ExampleLet us see another example wherein we are drawing a character with different coordinates and height/ width as shown in the above example:OutputThe following is the output:

imagearc() function in PHP

Arjun Thakur
Updated on 31-Dec-2019 07:24:38

245 Views

The imagearc() function is used to draw an arc.Syntaximagearc( $img, $cx, $cy, $width, $height, $start, $end, $color )Parameters$img: Creates an image with imagecreatetruecolor().$cx: x-coordinate of the center.$cy: y-coordinate of the center.$width: The width of arc.$height: The height of arc.$start: The arc start angle, in degrees.$end: The arc end angle in degrees.$color: It sets the color of image.ReturnThe imagearc() function returns the TRUE on success or FALSE on failure.ExampleThe following is an example:OutputThe following is the output:ExampleLet us see another example wherein we have different coordinates and angle for arc:OutputThe following is the output:Read More

imagecolorclosest() function in PHP

George John
Updated on 31-Dec-2019 07:23:04

40 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: Live Demo

imagecolorallocatealpha() function in PHP

Ankith Reddy
Updated on 31-Dec-2019 07:22:02

200 Views

The imagecolorallocatealpha() function allocates a color for an image.Syntaximagecolorallocatealpha ( 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 imagecolorallocatealpha() function returns a color identifier or FALSE if the allocation failed.ExampleThe following is an example:OutputThe following is the output:

imagecolorallocate() function in PHP

Chandu yadav
Updated on 31-Dec-2019 07:21:19

465 Views

The imagecolorallocate() function allocates a color for an image.Syntaxint imagecolorallocate ( $img, $red, $green, $blue )Parametersimg: Image resource created with imagecreatetruecolor().red: Red color componentgreen: Green color componentblue: Blue color componentReturnThe imagecolorallocate() function returns a color in RGB format.ExampleThe following is an example:OutputThe following is the output:

Advertisements