通过调用HTC Incredible 上的Camera.takepicture()来拍照会导致图像混乱。这个问题不会出现在我测试过我的应用程序的任何其他设备上(Galaxy SII、Galaxy S、Nexus S)。我还没有能够自己找到解决方案...
图片链接: http: //i.stack.imgur.com/j4VE8.jpg (需要更多声誉才能发布)
这就是我保存 imageData 的方式:
static boolean StoreByteImage(Context mContext, byte[] imageData,
int quality, String expName) {
File sdImageMainDirectory = new File("/sdcard");
FileOutputStream fileOutputStream = null;
//String nameFile;
try {
BitmapFactory.Options options=new BitmapFactory.Options();
options.inSampleSize = 4;
Bitmap myImage = BitmapFactory.decodeByteArray(imageData, 0,
imageData.length,options);
fileOutputStream = new FileOutputStream(
sdImageMainDirectory.toString() +"/CapturedQRCode.jpg");
BufferedOutputStream bos = new BufferedOutputStream(
fileOutputStream);
myImage.compress(CompressFormat.PNG, quality, bos);
bos.flush();
bos.close();
} catch (FileNotFoundException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
return true;
}
有人有提示吗?