title: libjpeg-turbo java encode jpeg
body: <p>Ive installed libjpeg-turbo on my mac and added the jar and libs to my eclipse project. Im trying to create jpeg byte[] from my bufferedimage:</p>
  
  <pre><code>TJCompressor tj = new TJCompressor();
  tj.compress(image, TJ.PF_BGR);
  </code></pre>
  
  <p>The error I get is: java.lang.Exception: tjBufSize(): Invalid argument</p>
  
  <p>I use a custom robot to create my bufferedimage with the type TYPE_3BYTE_BGR. I can create a byte[] using ImageIO but its to slow.</p>
  
  <p>I tried to find some tutorials on the java wrapper, but I havnt found any that encode a jpeg from a bufferedimage. I would be very grateful if someone could help me.</p>