从数据库中获取图像后,当我尝试使用以下代码传递宽度进行调整大小时:
以下异常在该行抛出:
任何关于为什么只有某些图像会抛出此错误的想法。这些图像是否存在问题?如果是,可能的错误是什么?
public static BufferedImage resize(final byte[] pImageData,
final int width, final int height, final int maxLength, final int minLength, final String imageSubType) throws Exception {
InputStream is = null;
BufferedImage resizeImageJpg = null;
try {
is = new ByteArrayInputStream(pImageData);
BufferedImage originalImage = ImageIO.read(is);
--------------------
}
}
以下异常在该行抛出:
BufferedImage originalImage = ImageIO.read(is);
异常:
Caused by: java.awt.color.CMMException: Invalid image format
at sun.awt.color.CMM.checkStatus(CMM.java:131)
at sun.awt.color.ICC_Transform.<init>(ICC_Transform.java:89)
at java.awt.image.ColorConvertOp.filter(ColorConvertOp.java:516)
at com.sun.imageio.plugins.jpeg.JPEGImageReader.acceptPixels(JPEGImageReader.java:1169)
at com.sun.imageio.plugins.jpeg.JPEGImageReader.readImage(Native Method)
at com.sun.imageio.plugins.jpeg.JPEGImageReader.readInternal(JPEGImageReader.java:1137)
at com.sun.imageio.plugins.jpeg.JPEGImageReader.read(JPEGImageReader.java:948)
at javax.imageio.ImageIO.read(ImageIO.java:1422)
at javax.imageio.ImageIO.read(ImageIO.java:1326)
任何关于为什么只有某些图像会抛出此错误的想法。这些图像是否存在问题?如果是,可能的错误是什么?