java - Getting bitmap image from camera intent as thumbnail.How to make it bigger -
java - Getting bitmap image from camera intent as thumbnail.How to make it bigger -
i trying open photographic camera app , image onto imageview.even when utilize wrap content imageview's width , height, shown thumbnail.i have seen several posts resizing , not sure 1 use.the issue want image , in total size, not thumbnail.the next have tried:
inside button click event: intent cameraintent = new intent( android.provider.mediastore.action_image_capture); startactivityforresult(cameraintent, 111); @override protected void onactivityresult(int requestcode, int resultcode, intent data) { // todo auto-generated method stub if (resultcode == result_ok && requestcode == 111) { bitmap photo = (bitmap) data.getextras().get("data"); preview.setimagebitmap(photo); }
i trying show image preview within imageview.the issue want bigger image.when seek changing widht , height of imageview 300px , 150px , blank.
how bigger image?
edit:
intent intent = new intent("android.media.action.image_capture"); file file = new file(environment.getexternalstoragedirectory()+file.separator + "image.jpg"); intent.putextra(mediastore.extra_output, uri.fromfile(file)); startactivityforresult(intent, capture_image_fullsize_activity_request_code);
in on activity result:
if (requestcode == capture_image_fullsize_activity_request_code) { //get our saved file bitmap object: file file = new file(environment.getexternalstoragedirectory()+file.separator + "image.jpg"); bitmap bitmap = decodesampledbitmapfromfile(file.getabsolutepath(), 1000, 700); preview.setimagebitmap(bitmap); } public static bitmap decodesampledbitmapfromfile(string path, int reqwidth, int reqheight) { // best quality match //first decode injustdecodebounds=true check dimensions final bitmapfactory.options options = new bitmapfactory.options(); options.injustdecodebounds = true; bitmapfactory.decodefile(path, options); // calculate insamplesize, raw height , width of image final int height = options.outheight; final int width = options.outwidth; options.inpreferredconfig = bitmap.config.rgb_565; int insamplesize = 1; if (height > reqheight) { insamplesize = math.round((float)height / (float)reqheight); } int expectedwidth = width / insamplesize; if (expectedwidth > reqwidth) { //if(math.round((float)width / (float)reqwidth) > insamplesize) // if bigger sampsize.. insamplesize = math.round((float)width / (float)reqwidth); } options.insamplesize = insamplesize; // decode bitmap insamplesize set options.injustdecodebounds = false; homecoming bitmapfactory.decodefile(path, options); }
but still same size.
you have supply intent putextra alternative , filename store it. info snapshot.
intent intent = new intent(mediastore.action_image_capture); intent.putextra(mediastore.extra_output, uri.fromfile(new file(filepath)));
it'll save image specified location (as long it's writable , such)
java android css image bitmap
Comments
Post a Comment