Android Camera Parameters setJpegQuality deprecated? Custom camera application

老子叫甜甜 提交于 2019-12-02 01:46:49

For S3 and S4, you can write device specific code to reduce the size of file.

If you search on google, Android dev team also mentioned that it all depends on the implementation by the manufacturer(https://code.google.com/p/android/issues/detail?id=8091). The implementation of the camera parameters and function totally depends on the hardware used I think.

I had used motion sensors for one of my apps. There also, I had to write device specific code, to get the required behaviour in the app.

I know its not what we expect as a developer, but i believe we, developers, can fix anything. :)

I use the CWAC-Camera library for my custom camera. I forked the main repository and added a jpegQuality parameter to the PictureTransaction:
https://github.com/cookbrite/cwac-camera/commit/65a0a2082194dfc8069f605f0191c43357bb0852

This ensures that the resulting picture is always compressed to the required quality.

One drawback with this approach is that it has to load and compress the full size image file in application code, whereas using setJpegQuality on the Camera.Parameters may be more optimized.

Sorry I didnt see answers finaly come :) I dont even use this not working parameters anymore

I found a solution to set the quality of my picture, when i save it as file :

FileOutputStream fos = new FileOutputStream(finalFilePath);
bmp.compress(Bitmap.CompressFormat.JPEG, jpegQuality, fos);

Hope it helps

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!