简体   繁体   中英

Forcing android camera resolution

In my android app, I would like to be able to limit the maximal resolution (or size in mb) of a picture being taken.

here is how i call the camera activity :

Intent intent = new Intent( MediaStore.ACTION_IMAGE_CAPTURE );
intent.putExtra( MediaStore.EXTRA_OUTPUT, Uri.fromFile( new File( mTmpFilePath ) ) );
intent.putExtra( "filename", mTmpFilePath );
startActivityForResult( intent, REQUEST_CAMERA );

Is there anyway to force or limit the camera resolution ?

If you start camera application with intent, you are depending on this application good will. (some implementation will support this, and some not). You can try to set up image resolution via camera class, but I found that not all advertised sizes are supported, some are ignored and some produce errors - camera applications behave differently on different devices.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM