그래서 이미지 미리보기를 얻은 다음 저장하는 방법에 대한 많은 자습서를 읽었습니다. 일반적인 튜토리얼에는 SurfaceHolder
및 SurfaceView
에 PictureCallback
을 사용하는 것이 포함됩니다.onPictureTaken 메서드 - 데이터를 tiff로 가져 오는 중?
는 documentation이 나타납니다으로는
/** Handles data for jpeg picture */
PictureCallback jpegCallback = new PictureCallback() {
public void onPictureTaken(byte[] data, Camera camera) {
FileOutputStream outStream = null;
try {
// write to local sandbox file system
// outStream =
// CameraDemo.this.openFileOutput(String.format("%d.jpg",
// System.currentTimeMillis()), 0);
// Or write to sdcard
outStream = new FileOutputStream(String.format(
"/sdcard/%d.jpg", System.currentTimeMillis()));
outStream.write(data);
outStream.close();
Log.d(TAG, "onPictureTaken - wrote bytes: " + data.length);
} catch (FileNotFoundException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
} finally {
}
Log.d(TAG, "onPictureTaken - jpeg");
}
};
같은 것을 할 수있는 이미지를 저장하는
public abstract void onPictureTaken (byte[] data, Camera camera)
보통
에 서명하지만 나는 절약에 관심이 아니에요 jpeg. 티파니 이미지를 저장하고 싶습니다. 설명서를 읽은 나는 형식에 대한 일반적인 논평을 발견했습니다 :
사진을 찍은 후에 이미지 데이터를 사용할 수있을 때 호출됩니다. 데이터의 형식은 콜백 컨텍스트 및 Camera.Parameters 설정에 따라 다릅니다.
그래서 나는 Camera.Parameters을 클릭했지만 유용한 것은 찾지 못했습니다.
tiff로 바이트를 저장하는 방법이 있습니까? 내가 뭔가 잘못하고 있는거야?
봐 : http://developer.android.com/reference/android/hardware/Camera.Parameters.html#getSupportedPictureFormats() 내가 티파니가 기본적으로 지원됩니다 생각하지 않습니다하지만 당신은 항상 호출 할 수 있습니다 그 방법을 통해 사용할 수있는 것을 볼 수 있습니다. 사용 가능한 이미지 형식 목록은 여기에서 찾을 수 있습니다. http://developer.android.com/reference/android/graphics/ImageFormat.html – calderonmluis
아무도 tiff를 더 이상 사용하지 않으며 다른 형식이 일반적으로 훨씬 우수하므로 어떤 카메라 하드웨어에서도 Tiff가 지원되지 않을 수 있습니다. 어쩌면 tiff 파일을 인코딩 할 수있는 라이브러리를 찾을 수 있습니다. http://www.awaresystems.be/imaging/tiff/faq.html 그 라이브러리가 존재해야한다고 언급합니다. – zapl