PHP development skills: PHP's understanding of image color

Source: Internet
Author: User
Tags color identifier image identifier transparent color
Syntax: intimagecolortransparent (intim [, intcol]) This function specifies a transparent back landscape for the image, im is the image identifier, col is the color specified for the image by applying the ImageColorAllocate function, the returned value is the identifier of the new transparent color.

1. imagecolorallocate
Syntax: int imagecolorallocate (int im, int red, int green, int blue)
This function is used to set the color of the RGB mode in an image represented by im. the returned value is an identifier that uniquely identifies the color of an im image, only the color specified by the application modification function can be applied to a specific image. all practical colors in an image must be specified in this way. In addition, one image cannot apply the color of another image.

2. imagecolortransparent
Syntax: int imagecolortransparent (int im [, int col])
This function specifies a transparent back-to-landscape for the image, im is the image identifier, col is the application of the ImageColorAllocate function to specify the color of the image, the returned value is the newly specified transparent color identifier

3. imagecolorat
Syntax: int imagecolorat (int im, int x, int y)
This function can be used to obtain the color value of the vertex source element in the image. The im parameter is the identifier of the image, and x and Y are the abscissa and ordinate coordinates of the position of the point in the image.

4. imagecolorclosest
Syntax: int imagecolorclosest (int im, int red, int green, int blue)
This function can calculate the color of a certain point in the given image and the index value of which color is the closest, and the parameter im is the image identifier.

5. imagecoloeset
Syntax: bool imagecolorset (int im, int index, int red, int green, int blue)
This function can set the color of the specified index in the color index table of the image. Index is the specified index number.

6. imagecolorsforindex
Syntax: array imagecolorsforindex (int im, int index)
This function obtains the specified color from the element index table of the image based on the index number.

7. imagecolorstotal
Syntax: int imagecolorstotal (int im)
This function detects the total number of colors applied to an image.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.