title: Magick++ ``depth`` does not behave the same as ``convert -depth``
body: <p>I discovered via <a href="https://stackoverflow.com/q/63125871/5446972">my previous question</a> that <code>depth</code> appears to work differently when I use it in ImageMagick's <code>convert</code> vs <code>Magick++</code>.</p>
  <h2>CLI version and result</h2>
  <p>Using:</p>
  <pre class="lang-sh prettyprint-override"><code>$ convert /foo/bar.ppm -depth 1 /foo/out.ppm
  </code></pre>
  <p>I get an output image which, upon inspection, shows a 1-bit color depth:</p>
  <pre class="lang-sh prettyprint-override"><code>$ identify /foo/out.ppm
  
  out.ppm PPM (blah blah) 1-bit sRGB (blah blah)
  </code></pre>
  <h2>C++ version and result</h2>
  <p>Using the code:</p>
  <pre class="lang-cpp prettyprint-override"><code>#include &lt;Magick++.h&gt;
  
  int main(int argc, char **argv) {
      Magick::InitializeMagick(*argv);
      Magick::Image img;
      img.read(&quot;/foo/bar.ppm&quot;);
      Magick::Image temp_img(img);
      temp_img.depth(1);
      temp_img.write(&quot;/foo/out.ppm&quot;);
      return 0;
  }
  </code></pre>
  <p>Compiled using the command:</p>
  <pre class="lang-sh prettyprint-override"><code>g++ -std=c++17 test.cpp -o test `Magick++-config --cppflags --cxxflags --ldflags --libs`
  </code></pre>
  <p>Produces the output:</p>
  <pre class="lang-sh prettyprint-override"><code>$ identify /foo/out.ppm
  
  out.ppm PPM (blah blah) 8-bit sRGB (blah blah)
  </code></pre>
  <h2>Hardware</h2>
  <p>I have run this with the same result on on:</p>
  <ul>
  <li>Raspberry Pi - Raspbian 10 (buster)</li>
  <li>Laptop - Ubuntu 18.04 (bionic beaver)</li>
  </ul>
  <h2>Software (on the RPi)</h2>
  <pre class="lang-sh prettyprint-override"><code>$ apt list --installed | grep magick
  
  WARNING: apt does not have a stable CLI interface. Use with caution in scripts.
  
  graphicsmagick-libmagick-dev-compat/stable,now 1.4+really1.3.35-1~deb10u1 all [installed]
  imagemagick-6-common/stable,now 8:6.9.10.23+dfsg-2.1+deb10u1 all [installed,automatic]
  imagemagick-6.q16/now 8:6.9.10.23+dfsg-2.1 armhf [installed,upgradable to: 8:6.9.10.23+dfsg-2.1+deb10u1]
  imagemagick/now 8:6.9.10.23+dfsg-2.1 armhf [installed,upgradable to: 8:6.9.10.23+dfsg-2.1+deb10u1]
  libgraphics-magick-perl/stable,now 1.4+really1.3.35-1~deb10u1 armhf [installed,automatic]
  libgraphicsmagick++-q16-12/stable,now 1.4+really1.3.35-1~deb10u1 armhf [installed,automatic]
  libgraphicsmagick++1-dev/stable,now 1.4+really1.3.35-1~deb10u1 armhf [installed,automatic]
  libgraphicsmagick-q16-3/stable,now 1.4+really1.3.35-1~deb10u1 armhf [installed,automatic]
  libgraphicsmagick1-dev/stable,now 1.4+really1.3.35-1~deb10u1 armhf [installed,automatic]
  libmagick++-6-headers/stable,now 8:6.9.10.23+dfsg-2.1+deb10u1 all [installed,auto-removable]
  libmagick++-6.q16-8/stable,now 8:6.9.10.23+dfsg-2.1+deb10u1 armhf [installed,auto-removable]
  libmagickcore-6-arch-config/stable,now 8:6.9.10.23+dfsg-2.1+deb10u1 armhf [installed,auto-removable]
  libmagickcore-6-headers/stable,now 8:6.9.10.23+dfsg-2.1+deb10u1 all [installed,auto-removable]
  libmagickcore-6.q16-6-extra/stable,now 8:6.9.10.23+dfsg-2.1+deb10u1 armhf [installed,automatic]
  libmagickcore-6.q16-6/stable,now 8:6.9.10.23+dfsg-2.1+deb10u1 armhf [installed,automatic]
  libmagickwand-6-headers/stable,now 8:6.9.10.23+dfsg-2.1+deb10u1 all [installed,auto-removable]
  libmagickwand-6.q16-6/stable,now 8:6.9.10.23+dfsg-2.1+deb10u1 armhf [installed,automatic]
  </code></pre>
  <h2>The Picture</h2>
  <p>I've tested with multiple input files with <code>sRGB</code> type.  I convert everything to NetBPM format before starting my test e.g.:</p>
  <pre><code>convert yourimage.jpg /foo/bar.ppm
  </code></pre>
  <h2>The Question</h2>
  <p>Why is the C++ different from the Bash version?  They should be linking to the exact same code in the background.  The input value for depth does not need to be a special type (<code>Magick::Image.depth</code> takes <code>size_t</code>).  Is there something in my installation which is messing this up?  I know most of it is based on ImageMagick v6 because debian repos are notoriously slow, but nothing has changed (to my knowledge) in the source code which should effect the <code>depth</code>.</p>
  <h2>What else doesn't work?</h2>
  <h3>Quantization</h3>
  <p>Adding:</p>
  <pre><code>temp_img.quantizeColorSpace(Magick::GRAYColorspace);
  temp_img.quantizeColors(1);
  temp_img.quantize( );
  </code></pre>
  <p>to the code should also be a method which reduces the color depth.  Again, this results in an 8-bit image in C++.</p>
  <h3>Monochrome</h3>
  <p>This results in an 8-bit image in both CLI and C++</p>