473,799 Members | 3,276 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Pixel colour

I'm using PHP4.2.2 with gd on a Linux platform and am having difficulty
in solving a little problem despite going through the definitions of the
various image functions.

If you load a true-colour image from a file using...

$image=imagecre atefrompng("fil e.png");

....how do you then get the red, green and blue values of a pixel at $x,
$y within that image? I'm sure it's fairly simple but I can't find this
from what I've read so far.

Can anyone give me any pointers?
Jul 17 '05 #1
2 1922
Derek Scollon <ds******@scotw ebsolutions.com > wrote:
I'm using PHP4.2.2 with gd on a Linux platform and am having difficulty
in solving a little problem despite going through the definitions of the
various image functions.

If you load a true-colour image from a file using...

$image=imagecre atefrompng("fil e.png");

...how do you then get the red, green and blue values of a pixel at $x,
$y within that image? I'm sure it's fairly simple but I can't find this
from what I've read so far.


imagecolorat():
http://uk.php.net/manual/en/function.imagecolorat.php

HTH;
JOn
Jul 17 '05 #2
Jon Kraft wrote:
Derek Scollon <ds******@scotw ebsolutions.com > wrote:

I'm using PHP4.2.2 with gd on a Linux platform and am having difficulty
in solving a little problem despite going through the definitions of the
various image functions.

If you load a true-colour image from a file using...

$image=imagec reatefrompng("f ile.png");

...how do you then get the red, green and blue values of a pixel at $x,
$y within that image? I'm sure it's fairly simple but I can't find this
from what I've read so far.

imagecolorat():
http://uk.php.net/manual/en/function.imagecolorat.php

HTH;
JOn


Brilliant. I missed this function completely. Thanks very much Jon.
Jul 17 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
6223
by: Weston C | last post by:
Is there any way to use javascript to pull the color of the pixel under the mouse pointer off the page? Thanks, Weston ~==~ http://weston.canncentral.org/ weston8cann8central.org (remove eights to email me)
7
1751
by: walter.alex | last post by:
November 16 2005 -- The recent launch of the new 5 year advertising solution from MillionPixelClick.com means the pixel advertising craze will continue unabated. Selling advertising space by the pixel the new form of advertising is proving popular with both clients and providers alike. Designed to boost traffic, an image is placed on MillionPixelClick.com with a link to your website. These pixels will be visible for at least 5 years....
3
2915
by: Mark Ingram | last post by:
Hi, ive got an imagine in a PictureBox, and would like to get the colour of the pixel when the mouse is over the control. From what ive (briefly) seen, there is no way to do this directly in C# and requires you to use GetPixel from the Win API? Is this correct? Any other better ways of doing this? Thanks,
30
9089
by: Chaos | last post by:
As my first attempt to loop through every pixel of an image, I used for thisY in range(0, thisHeight): for thisX in range(0, thisWidth): #Actions here for Pixel thisX, thisY But it takes 450-1000 milliseconds I want speeds less than 10 milliseconds
4
1342
by: ChillUmesh | last post by:
can we do a program to change colour of each pixel of the form. If so can anyone help me in this. thnx.....
4
3725
by: Johny | last post by:
I use PIL to write some text to a picture.The text must be seen wery clearly. I write the text to different pictures but to the same position. As pictures maybe different, colour, in the position where I write the text, is also different. Is there a way how to set the font colour so that it will be seen very clearly in the picture? For example, if the picture is bright ( for example yellow), the font colour should be dark( e.g. black)...
2
2094
by: kuratkull | last post by:
Hello, I haven't asked If I wasn't really confused :) OK, so I am just beginning SDL programming in C, and I was running fine, until I tried getting a pixel colour. Basically, I am trying to run the code from this page: http://www.libsdl.org/cgi/docwiki.cgi/Pixel_20Access This is the cut down version of my code:
4
3568
by: cjstuttle | last post by:
Could anyone help me, I'm a python noob and need some help. im trying to find some code that will, given a screen co-ordinate, will give me the colour of that pixel in RGB. i have found a lot about getting the pixel colour from a picture file with a given co-ordinate, but is it possible to do it from the whole screen output regardless what application the selected pixel is in? any help would be help. thanks, Chris
0
9687
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10251
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
10027
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
7565
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5463
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5585
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4141
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3759
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2938
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.