title: Getting color from external image using JavaScript
body: <p>So, I have tried looking this up in many places, but have not yet found an answer for my situation.</p>
  
  <p>What I have is a loop, looping for each hour in a day for every day in a year, and, with many insanely ridiculous mathematical equations, getting the angle and distance of the sun at a specific location.</p>
  
  <p>The outcome of the equations gives me a number that I <strong>use as an x value</strong> to obtain to the image's <strong>pixel color</strong> at that point. The image is a gradient: when x=0; no sunlight, when x=(1/2)imageWidth; sunrise/sunset, when x=imageWidth; full sunlight.</p>
  
  <p>I had this code working in Processing. Though I would love to just use Processing.js, I am unable to for this project. I am trying to build this with the <a href="http://d3js.org/" rel="nofollow">D3</a> and <a href="http://momentjs.com/" rel="nofollow">Moment</a> libraries.</p>
  
  <p>To the point:</p>
  
  <p>I need to figure out how to <strong>pick colors</strong> from the pixels of an external (<strong>not</strong> visible) image, using a value I obtain from equations as the <strong>x value of the image</strong>.</p>
  
  <p>I have the value I need. I just need help figuring out <strong>how to get the color of the pixel of an image that is not visible at the specific x location of that image</strong>. I will then <strong>use that color as a fill color for a circle</strong>.</p>
  
  <p>I realize this may not be worded ideally. It is kind of difficult to lift my head up from writing ridiculous math equations in JavaScript, and then ask questions about obtaining pixel color values of an external image. But, I hope someone out there can help me out!</p>
  
  <p><strong>EDIT</strong>: This all will end up as a webpage.</p>