This discussion is archived
1 Reply Latest reply: Apr 25, 2010 8:53 AM by 798853 RSS

Convert adobe1998RGB to sRGB

843802 Newbie
Currently Being Moderated
Hi,

I'm trying to convert jpeg file with ICC_PROFILE adobe1998rgb in SRGB but the result is darker...
I try to convert with ColorConvertOp and the image is less darker but always darker than the orignal...
Anyone can help?
And Thx you!
File fileSrc = new File(source);
Iterator<ImageReader> readers = ImageIO.getImageReadersByFormatName("jpeg");
ImageReader reader = readers.next();
ImageInputStream iis = null;

iis = ImageIO.createImageInputStream(fileSrc);
reader.setInput(iis, true);
BufferedImage bi = reader.read(0, null);
BufferedImage dst = new BufferedImage(bi.getWidth(), bi.getHeight(), BufferedImage.TYPE_3BYTE_BGR);
ColorConvertOp op = new ColorConvertOp(bi.getColorModel().getColorSpace(), dst.getColorModel().getColorSpace(), null);
op.filter(bi, dst);

Iterator<ImageWriter> writers = ImageIO.getImageWritersByFormatName("jpeg");
JPEGImageWriter writer = (JPEGImageWriter) writers.next();
File file = new File(fileName);
file.delete();
writer.setOutput(new FileImageOutputStream(file));
writer.write(null, new IIOImage(dst, null, null), null);
Edited by: nDija on Apr 20, 2010 8:14 AM
  • 1. Re: Convert adobe1998RGB to sRGB
    798853 Newbie
    Currently Being Moderated
     
    
      // Create an RGB color model
         int[] bits = { 8, 8, 8 };
         ColorModel colorModel = new
          ComponentColorModel(ColorSpace.getInstance(ColorSpace.CS_sRGB),
                              bits, false, false,
                              Transparency.OPAQUE,
                              DataBuffer.TYPE_BYTE);