title: GIMP palette file (.gpl) format / syntax?
body: <p>I'm looking for the exact specifications of this file format. Anyone got a link?  Or want to comment?</p>
  
  <p>I have spent the better part of the day searching, yet I keep getting directed back to the GIMP online user-manual.  It says "look at a .gpl file and you will see it is easy" to build manually with a text editor.  I don't actually have GIMP, but I see examples online.  Yep, easy.  • EXCEPT:</p>
  
  <p>• What meaning do the color names ultimately have? Are they purely semantic, or does a program rely on them?  If the latter, then what if there are two (2) or more colors with the same name?</p>
  
  <p>• What does the "Columns" line do? 
  I've seen examples that have no "Columns" line.
  I've seen examples that have values of 0, 4, and 16; yet this does not in any way that I can see correspond to the color data.  I see 3 columns of decimal-sRGB values, and an optional 4th column with the color-name; seems I remember the example with "Columns 4" had no color names, only the 3 RGB columns.</p>
  
  <p>• Do columns of RGB values need to "line up"?  Or will the following example from my output algorithm work? (from the Crayola palette):</p>
  
  <pre><code>159 129 112 Beaver
  253 124 110 Bittersweet
  0 0 0 Black
  172 229 238 Blizzard Blue
  31 117 254 Blue
  162 162 208 Blue Bell
  102 153 204 Blue Gray
  13 152 186 Blue Green
  </code></pre>
  
  <p>• Does this format accept sRGBA colors?  And if so, how is the "A" value defined (0-1, 0%-100%, 0-127, 0-255, etc.?) (seems I remember when creating .png files with PHP, the "A" value was 7-bit)?</p>
  
  <p>• How exactly do you add comments / metadata? 
  Today I see an example that says lines that begin with # are comments, or anything after a # on a line is a comment.  Yesterday I thought (maybe I'm confused) I saw an example that said that comment lines begin with ;</p>
  
  <p>• Is any other data-format supported? 
  Originally I thought the text-line just before the color-data that I see in every example indicated the format: "#" signifying decimal-sRGB; until today when I see that is just a blank-line comment.</p>
  
  <p>• What line ending character(s) can / must I use? 
  <code>\n</code> 
  <code>\r</code> </p>
  
  <p>• What character-encodings can I use?  ASCII only?  ¿UTF-8 ☺ with extended ♪♫ charset (¡hopefully!)?</p>
  
  <p>• Anything I'm missing?  Any other options available?</p>
  
  <p>Here is an example from <a href="http://gimpchat.com/viewtopic.php?f=8&amp;t=3375#" rel="noreferrer">http://gimpchat.com/viewtopic.php?f=8&amp;t=3375#</a> </p>
  
  <pre><code>GIMP Palette
  Name: bugslife_final.png-10
  Columns: 16
  #
  191 180 180   Index 0
  163 158 157   Index 1
  145 136 132   Index 2
  130 125 112   Index 3
  … … …
  56  50  49   Index 29
  41  38  38   Index 30
  23  23  23   Index 31
  242 245 213   Index 32
  227 232 181   Index 33
  210 217 147   Index 34
  195 204 118   Index 35
  … … …
    0   0   0   Index 251
    0   0   0   Index 252
    0   0   0   Index 253
    0   0   0   Index 254
    0   0   0   Index 255
  </code></pre>
  
  <p>Aloha! </p>