...Beauty, cleaning, DIY tips and more - free to join!
   Login   Contact us   Site map   Puzzle Club   Ask a question    Newsletter

How To Find Image Colours

Computing : Learning PHP

If you want to find the colours of particular pixels in an image, then you can do so easily with PHP and the GD graphics library.

This will have many applications - for instance if you want to stick a pin in a map dynamically and want it to blend in with the background then you can set the transparency using the method by finding the background colour.

All you need to do is use the imagecolorat() function, and pass to it the image identifier, pixel-x and pixel-y co-ordinates.

It then returns the RGB values for the pixel that you specify.

This is a handy technique and has many applications in a surprisingly wide range of uses.


Profile image!
By: Stephen

  Reply to How To Find Image Colours

  Receive Our Newsletter

PHP picture



Questions about PHP:

Ask question

More Articles:
How to manage a web design project
How to write PDFs with PHP
How to increase sales