title: Java CMYK to RGB with profile. Output is too dark
body: <p>Similar question has been asked many times.
  But I still don't get why I get too dark output after I converted a picture with ICC_Profile.
  I've tried many profiles: from Adobe site, and from the picture itself.</p>
  
  <p><strong>Before Image</strong></p>
  
  <p><img src="https://i.stack.imgur.com/HHGes.png" alt="Before Image"></p>
  
  <p><strong>After Image</strong></p>
  
  <p><img src="https://i.stack.imgur.com/4erZj.png" alt="After Image"></p>
  
  <p><strong>Code</strong></p>
  
  <pre><code>Iterator&lt;ImageReader&gt; readers = ImageIO.getImageReadersByFormatName("jpeg");
  ImageReader reader = null;
  while (readers.hasNext()){
        reader = readers.next();
        if (reader.canReadRaster()){
            break;
        }
  }
  // read
  ImageInputStream ios = ImageIO.createImageInputStream(new FileInputStream(new File(myPic.jpg)));
  reader.setInput(ios);
  Raster r = reader.readRaster(0, null);
  
  BufferedImage result = new BufferedImage(r.getWidth(), r.getHeight(), bufferedImage.TYPE_INT_RGB);
  WritableRaster resultRaster = result.getRaster();
  ICC_Profile iccProfile = ICC_Profile.getInstance(new File("profile_name.icc");
  ColorSpace cs = new ICC_ColorSpace(iccProfile);
  ColorConvertOp cmykToRgb = new ColorConvertOp(cs, result.getColorModel().getColorSpace(), null);
  cmykToRgb.filter(r, resultRaster);
  
  // write
  ImageIo.write(resul, "jpg", new File("myPic.jpg"));
  </code></pre>
  
  <p>Do I have to do something else after I have converted the picture?</p>