title: PHP get color at last pixels of image error
body: <p>I've made this code to get hex colors of the first pixel and the last pixel of an image.
  The code for the first pixel is working, I get the HEX code.
  But for the last pixel, I've an error:</p>
  
  <pre><code>PHP Notice:  imagecolorat(): 1,1024 is out of bounds in /var/playground/imghex.php on line 55
  </code></pre>
  
  <p>Here's my code:</p>
  
  <pre><code>$gradientHeight = getimagesize($res["gradient"]);
  // get Positions
  $im  = imagecreatefrompng($res["gradient"]);
  $rgb = imagecolorat($im, 0, 0);
  $r   = ($rgb &gt;&gt; 16) &amp; 0xFF;
  $g   = ($rgb &gt;&gt; 8) &amp; 0xFF;
  $b   = $rgb &amp; 0xFF;
  // store
  $res["Gradient1"] = rgb2hex([$r, $g, $b]);
  // get positions
  print_r($gradientHeight);
  $rgb2 = imagecolorat($im, $gradientHeight[0], $gradientHeight[1]);
  $r2   = ($rgb2 &gt;&gt; 16) &amp; 0xFF;
  $g2   = ($rgb2 &gt;&gt; 8) &amp; 0xFF;
  $b2   = $rgb2 &amp; 0xFF;
  // store
  $res["Gradient2"] = rgb2hex([$r2, $g2, $b2]);
  // print
  print_r($res);
  </code></pre>
  
  <p>What's wrong? I don't see any error</p>