Android: How to save a preview frame as jpeg image?

Posted by niko on Stack Overflow See other posts from Stack Overflow or by niko
Published on 2009-06-23T12:31:05Z Indexed on 2010/04/13 13:02 UTC
Read the original article Hit count: 682

Filed under:
|

Hi,

I would like to save a preview frame as a jpeg image.

I have tried to write the following code:

public void onPreviewFrame(byte[] _data, Camera _camera)
		{
			if(settings.isRecording())
			{
				Camera.Parameters params = _camera.getParameters();
				params.setPictureFormat(PixelFormat.JPEG);
				_camera.setParameters(params);
				String path = "ImageDir" + frameCount;
				fileRW.setPath(path);
				fileRW.WriteToFile(_data);
				frameCount++;
			}
		}

but it's not possible to open a saved file as a jpeg image. Does anyone know how to save preview frames as jpeg images?

Thanks

© Stack Overflow or respective owner

Related posts about android

Related posts about camera