Found 1046 Articles for PHP

imagecolormatch() function in PHP

Ankith Reddy
Updated on 31-Dec-2019 07:59:35

43 Views

The imagecolormatch() function forms the colors of the palette version of an image more closely match the true color versionSyntaxbool imagecolormatch ( img1, img2 )Parametersimg1: Create image with imagecreatetruecolor() function.img2: A palette image link resource pointing to an image. This image has the same size as img1.ReturnThe imagecolormatch() function returns TRUE on success or FALSE on failure.ExampleThe following is an example Live DemoOutputThe following is the output:1ExampleLet us see another example Live DemoOutputThe following is the output:1

imagecolortransparent() function in PHP

George John
Updated on 31-Dec-2019 07:58:19

272 Views

The imagecolortransparent() function is used to set the color of a transparent image.Syntaximagecolortransparent ( img, color )Parametersimg: Create image with imagecreatetruecolor() function.color: Color identifier created with imagecolorallocate().ReturnThe imagecolortransparent() function returns the identifier of the new transparent color. The return value is -1 if color is not specified and the image has no transparent color.ExampleThe following is an exampleOutputThe following is the output:

imagecolorresolve() function in PHP

Arjun Thakur
Updated on 31-Dec-2019 07:48:35

18 Views

The imagecolorresolve() function gets the index of the specified color or its closest possible alternative.Syntaximagecolorresolve (img , red , green , blue )Parametersimg: Image created with imagecreatetruecolor() function.red: The value of red component.green: The value of green component.blue: The value of blue component.ReturnThe imagecolorresolve() function returns the color index.ExampleThe following is an example Live DemoOutputThe following is the output:Array ( [0] => 128 [1] => 129 [2] => 130 )

imagecolorstotal() function in PHP

Chandu yadav
Updated on 31-Dec-2019 07:47:13

37 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 example Live DemoOutputThe following is the output:Number of Colors = 128

imagecolorset() function in PHP

Ankith Reddy
Updated on 31-Dec-2019 07:46:41

73 Views

The imagecolorset() function sets the color for the specified palette index. Using this create flood-fill-like effects in palleted images.Syntaximagecolorset ( img, index, red, green, blue, alpha )Parametersimg: Image created with imagecreatetruecolor() functionindex: The index in the palette imagered: Value of red componentgreen: Value of green componentblue: Value of blue componentalpha: The transparency if image.ReturnThe imagecolorset() function returns nothing.ExampleThe following is an exampleOutputThe following is the output:

imagecolorsforindex() function in PHP

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

56 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 example Live DemoOutputThe following is the output:array(4) { ["red"]=> int(255) ["green"]=> int(255) ["blue"]=> int(255) ["alpha"]=> int(127) }

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

30 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

669 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

607 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

Advertisements