Pixel colour

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Derek Scollon

    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?
  • Jon Kraft

    #2
    Re: Pixel colour

    Derek Scollon <dscollon@scotw ebsolutions.com > wrote:
    [color=blue]
    > 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.[/color]

    imagecolorat():
    PHP is a popular general-purpose scripting language that powers everything from your blog to the most popular websites in the world.


    HTH;
    JOn

    Comment

    • Derek Scollon

      #3
      Re: Pixel colour

      Jon Kraft wrote:[color=blue]
      > Derek Scollon <dscollon@scotw ebsolutions.com > wrote:
      >
      >[color=green]
      >>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.[/color]
      >
      >
      > imagecolorat():
      > http://uk.php.net/manual/en/function.imagecolorat.php
      >
      > HTH;
      > JOn[/color]

      Brilliant. I missed this function completely. Thanks very much Jon.

      Comment

      Working...