title: Python PIL - Finding Nearest Color (Rounding Colors)
body: <p>There is a game called Roblox, in which the player makes the game, usually of lego-looking bricks. </p>
  
  <p>In Roblox, for the Brick colors, you can use typical RGB values, but that'd require an additional element that is not very efficient when it comes to file size. Instead of using RGB values, BrickColor is much more economic in file size. It uses an integer to be interpreted as a certain color. <a href="http://wiki.roblox.com/index.php?title=BrickColor_codes" rel="noreferrer">Here is what I mean:</a>
  <a href="https://i.stack.imgur.com/ZcHML.png" rel="noreferrer"><img src="https://i.stack.imgur.com/ZcHML.png" alt="Color Codes"></a></p>
  
  <p>Here is a snippet of my code:</p>
  
  <pre><code>import Image
  f = raw_input('Image:\n')
  im = Image.open(f)
  rgb_im = im.convert('RGB')
  r, g, b = rgb_im.getpixel((x, y))
  </code></pre>
  
  <p>In my program, I need to find the color code closest to an RGB value. </p>
  
  <p><strong>How might this be accomplished?</strong></p>