ColorConvertOp
public ColorConvertOp(ICC_Profile[] profiles,
                      RenderingHints hints)
Constructs a new ColorConvertOp from an array of ICC_Profiles. The RenderingHints argument may be null. The sequence of profiles may include profiles that represent color spaces, profiles that represent effects, etc. If the whole sequence does not represent a well-defined color conversion, an exception is thrown. 
For BufferedImages, if the ColorSpace of the source BufferedImage does not match the requirements of the first profile in the array, the first conversion is to an appropriate ColorSpace. If the requirements of the last profile in the array are not met by the ColorSpace of the destination BufferedImage, the last conversion is to the destination's ColorSpace. For Rasters, the number of bands in the source Raster must match the requirements of the first profile in the array, and the number of bands in the destination Raster must match the requirements of the last profile in the array. The array must have at least two elements or calling the filter method for Rasters will throw an IllegalArgumentException. 
Parameters:
profiles - the array of ICC_Profile objects
hints - the RenderingHints object used to control the color conversion, or null 
Throws: 
IllegalArgumentException - when the profile sequence does not specify a well-defined color conversion 
NullPointerException - if profiles is null现在只能说个大概,原图片中raster bands数和color space components数不匹配
由具体哪些参数关联指定还不清楚,可能是大小,可能是少设置了什么参数(需要查阅一些资料才能知道),或者可能的话可以跟进源码中看看,尤其是java.awt.image.ColorConvertOp.filter方法

解决方案 »

  1.   

    是不是源图像类型的目标图像类型不一致所致?试试:/** 对服务器上的临时文件进行处理 */
    BufferedImage srcFile = ImageIO.read(new File(oldFile));
    /** 宽,高设定 */
    BufferedImage tag = new BufferedImage(width, height, srcFile.getType());
      

  2.   

    在这句话: Image srcFile = ImageIO.read(new File(oldFile));里找不到或不能识别OldFile,你需要确定文件的路径是否正确和类型是否正确
      

  3.   

    我也遇到类似的情况,把jpg改成png就可以了,具体原因不晓得////