大家。我尝试将图像保存为.dng扩展名。
我从ImageReader.OnImageAvailableListener中的ImageReader获取Image对象 比起我使用DngCreator类进行保存。
这是我的DngUtil类:
public class DngUtil {
private final DngCreator dngCreator;
private final Image image;
public DngUtil(DngCreator dngCreator, Image image) {
this.dngCreator = dngCreator;
this.image = image;
}
/**
* Writes the dng file to the supplied output.
*/
@TargetApi(Build.VERSION_CODES.LOLLIPOP)
public void writeImage(OutputStream dngOutput) throws IOException {
try {
dngCreator.writeImage(dngOutput, image);
} catch (AssertionError | IllegalStateException | IllegalArgumentException e) {
e.printStackTrace();
throw new IOException();
}
}
/**
* Closes the image. Must be called to free up resources when no longer needed. After calling
* this method, this object should not be used.
*/
@TargetApi(Build.VERSION_CODES.LOLLIPOP)
public void close() {
image.close();
dngCreator.close();
}}
此字符串引发IllegalArgumentException:不支持的图像格式256
dngCreator.writeImage(dngOutput, image);
怎么了?