title: Convert image to indexed color with custom palette through console
body: <p>I have image.png in truecolor,
  palette.png (N colors, where N>256) or text file, where list RGB color palette.
  How to get a picture with this palette?</p>
  
  <p>If I use imagemagick:</p>
  
  <pre><code>convert image.png -remap palette.png remap_image.png
  </code></pre>
  
  <p>It does not work.</p>
  
  <pre><code>convert image.png -map palette.png remap_image.png
  </code></pre>
  
  <p>Gives a very bad quality. The image is very noisy. File size is bigger than before.</p>
  
  <p>GIMP gives best quality:</p>
  
  <pre><code>Сonvert image to indexed color &gt; use custom palette
  </code></pre>
  
  <p>But GIMP is GUI. I need to convert a lot images in the console without running the gimp and X.org.</p>