title: Magick++ - JPEG compressed TIFF
body: <p>I have a problem creating a TIFF image with a JPEG compression using Magick++, the C++ API of ImageMagick. When I use the convert tool the following way, it works:</p>
  
  <pre><code>convert 1.jpg -compress JPEG 1.tiff
  </code></pre>
  
  <p>When I want to do the same in C++, it looks like this:</p>
  
  <pre><code>Image img("1.jpg");
  img.compressType(JPEGCompression);
  img.write("1.tiff");
  </code></pre>
  
  <p>But this code does <strong>not</strong> work. It throws an exception when it tries to generate the file "1.tiff":</p>
  
  <pre><code>Unhandled exception at 0x74ecb727 in test.exe: Microsoft C++ exception: Magick::ErrorCoder at memory location 0x002ffc2c..
  </code></pre>
  
  <p>It points to <strong>Line 103</strong> in file <strong>Thread.cpp</strong></p>
  
  <p>Is this a bug or is something wrong with my code?</p>
  
  <p><strong>Update</strong></p>
  
  <p>I changed the code to this:</p>
  
  <pre><code>try{
      Image img(Desktop+"1.jpg");
      img.compressType(JPEGCompression);
      img.write(Desktop+"1.tiff");
  }catch(Exception e){
      cout &lt;&lt; e.what() &lt;&lt; endl;
  }
  </code></pre>
  
  <p>Output:
  test.exe: CompressionNotSupported `JPEG' @ error/tiff.c/WriteTIFFImage/2611</p>
  
  <p>So... it seems to be not supported. The question is: Why does he convert tool support it then? Does someone know a way to do it?</p>
  
  <p><strong>Update</strong></p>
  
  <p>I've created an empty new project, recompiled ImageMagick and then added the following settings:</p>
  
  <p>additional include dirs:</p>
  
  <pre><code>c:/imagemagick/magick++/lib;c:/imagemagick/
  </code></pre>
  
  <p>additional lib dirs:</p>
  
  <pre><code>c:/imagemagick/visualmagick/lib/
  </code></pre>
  
  <p>libs:</p>
  
  <pre><code>CORE_RL_bzlib_.lib;CORE_RL_coders_.lib;CORE_RL_filters_.lib;CORE_RL_jbig_.lib;CORE_RL_jp2_.lib;CORE_RL_jpeg_.lib;CORE_RL_lcms_.lib;CORE_RL_libxml_.lib;CORE_RL_magick_.lib;CORE_RL_Magick++_.lib;CORE_RL_png_.lib;CORE_RL_tiff_.lib;CORE_RL_ttf_.lib;CORE_RL_wand_.lib;CORE_RL_xlib_.lib;CORE_RL_zlib_.lib;CORE_RL_wmf_.lib;X11.lib;Xext.lib;kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;wsock32.lib;winmm.lib;
  </code></pre>
  
  <p>and then tried to run the following code:</p>
  
  <pre><code>#include &lt;iostream&gt;
  #include &lt;Magick++.h&gt;
  
  using namespace std;
  using namespace Magick;
  
  int main() {
      Image img("c:/users/patrik stutz/Desktop/1.jpg");
      img.compressType(JPEGCompression);
      img.write("c:/users/patrik stutz/Desktop/1.tiff");
      return 0;
  }
  </code></pre>
  
  <p>And it worked!! All using VS2010. I have no clue why it didn´t work in my other project with the same settings...</p>