So ive been reading a few posts some using Bitmap.createScaledBitmap, some using .compress feature and each one i try, never throws an exception or error, but file never gets resized.
I found this routine, but it doesnt do anything as far as the image taken. So basically within my app i allow the user to take a pic to attach to the submission. When you take the image, it displays a thumbnail on the screen, at this point the image is already saved to the phones gallery. I need to resize it (without changing the proportions) to make sure that the image is no larger than 200px wide or high because once you submit the form, im uploading the image to our server. public Bitmap getResizedBitmap(Bitmap bm, int newWidth, int newHeight) { int width = bm.getWidth(); int height = bm.getHeight(); float scaleWidth = ((float) newWidth) / width; float scaleHeight = ((float) newHeight) / height; // CREATE A MATRIX FOR THE MANIPULATION Matrix matrix = new Matrix(); // RESIZE THE BIT MAP matrix.postScale(scaleWidth, scaleHeight); // "RECREATE" THE NEW BITMAP Bitmap resizedBitmap = Bitmap.createBitmap(bm, 0, 0, width, height, matrix, false); return resizedBitmap;} When the user clicks the image button on the screen, the camera opens and allows them to take the pic, ive tried to call the above routine within this event after everything so that i know the file is created and exists. Here is the event for that: private ImageButton.OnClickListener takePicture_Button_listener = new ImageButton.OnClickListener() { public void onClick(View v) { StrictMode.setThreadPolicy(new StrictMode.ThreadPolicy.Builder() .detectDiskReads() .detectDiskWrites() .detectNetwork() .penaltyLog() .build()); // create Intent to take a picture and return control to the calling application Intent intent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE); //User fileUri for full path to image taken. fileUri = getOutputMediaFileUri(MEDIA_TYPE_IMAGE); // create a file to save the image fname = fileUri.toString().substring(fileUri.toString().lastIndexOf("/")+1); intent.putExtra(MediaStore.EXTRA_OUTPUT, fileUri); // set the image file name // start the image capture Intent startActivityForResult(intent, CAPTURE_IMAGE_ACTIVITY_REQUEST_CODE); } }; Ive tried to use it here after the previewCapturedImage routine is called and ive even tried the currently commented out code seen below and neither modify the file. protected void onActivityResult(int requestCode, int resultCode, Intent data) { if (requestCode == CAPTURE_IMAGE_ACTIVITY_REQUEST_CODE && resultCode == RESULT_OK) { previewCapturedImage(); //Bitmap bitmap = BitmapFactory.decodeFile(fileUri.getPath()); //getResizedBitmap(bitmap,200,200); } else if (resultCode == RESULT_CANCELED) { // User cancelled the image capture Toast.makeText(this, "Image Capture Cancelled:\n" + data.getData(), Toast.LENGTH_LONG).show(); } else { // Image capture failed, advise user Toast.makeText(this, "Image Capture Failed:\n" + data.getData(), Toast.LENGTH_LONG).show(); } } Where can i properly resize the image, either during or after its taken so that the actual image stored on the device is within my size requirements and file size, currently since its not resizing its creating a 4mb file which takes forever to upload and has some huge dimensions(5213x2988) I just need to make sure that the full size image is no larger than 200px width or height, it obvisously needs to keep its proportions, but the max cant be any larger than 200px -- You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en --- You received this message because you are subscribed to the Google Groups "Android Developers" group. To unsubscribe from this group and stop receiving emails from it, send an email to android-developers+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.