views:

17

answers:

0

Hi again, I'm converting a TYPE_RGB BufferedImage to a TYPE_BYTE_BINARY w/ a custom IndexColorModel 4b size there's no big deal in this just a commom function, the problem that it's taking a real long time to convert. An image with dimensions 680x384 takes something like between 1~2 minutes (and NO, I'm not using a 386DX40 =P). Well I tried the same conversion to a binary image, and takes more or less the same time.

...I thought that maybe it's related with the fact that I'm not passing a RenderingHints object to ColorConvertOP...

Well thanks in advance.

Here's the code of the conversion:

public static BufferedImage convert4(BufferedImage src) {
    IndexColorModel icm = new IndexColorModel(4, cmap.length, cmap, 0, false, Transparency.OPAQUE, DataBuffer.TYPE_BYTE);
    BufferedImage dest = new BufferedImage(src.getWidth(), src.getHeight(), BufferedImage.TYPE_BYTE_BINARY,icm);
    ColorConvertOp cco = new ColorConvertOp(src.getColorModel().getColorSpace(), dest.getColorModel().getColorSpace(), null);
    cco.filter(src, dest);
    return dest;
}