title: R - extract georeferenced raster pixel color
body: <p>I would like to <strong>extract the color values for each pixel of a georeferenced raster image</strong> using R. I need those pixel colors later to plot a tif (or geotif) as mentioned in a previous question (see <a href="https://stackoverflow.com/questions/19196923/r-original-colours-of-georeferenced-raster-image-using-ggplot2-and-raster-pac">R - original colours of georeferenced raster image using ggplot2- and raster-packages</a>). Due to the fact that raster images with data-band cannot implicitly use the band-values to assign colors to them (not able to represent pattern fills), I defenitely need those pixel colors. I already know how to access the <code>colortable</code> where all possible 256 colors are listed in a vector. However, they are not mapped in this form. Here is the code which I use to load the raster image and extract the unmapped <code>colortable</code>:</p>
  
  <pre><code>raster1 &lt;- raster(paste(
         workingDir, "/HUEK200_Durchlaessigkeit001_proj001.tif",
         sep="", collapse=""))
  raster1.pts &lt;- rasterToPoints(raster1)
  raster1.df &lt;- data.frame(raster1.pts)
  colTab &lt;- attr(raster1, "legend")@colortable
  </code></pre>
  
  <p><strong>Thank you for your help!</strong></p>