Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>yourSelectedImageBitmap = BitmapFactory.decodeFile(filePath, options);</p> <pre><code> if (yourSelectedImageBitmap != null) { // ----------resize for set in imageView------------ int width = yourSelectedImageBitmap.getWidth(); int height = yourSelectedImageBitmap.getHeight(); int newWidth = 140; int newHeight = 140; // calculate the scale - in this case = 0.4f float scaleWidth = ((float) newWidth) / width; float scaleHeight = ((float) newHeight) / height; Matrix matrix = new Matrix(); // resize the bit map matrix.postScale(scaleWidth, scaleHeight); if (exifOrientation.equals("6")) { matrix.postRotate(90); } Bitmap resizedBitmap = Bitmap.createBitmap(yourSelectedImageBitmap, 0, 0, width, height, matrix, true); image.setImageBitmap(resizedBitmap); // Toast.makeText(getApplicationContext(), // "in the select image loop", 2000).show(); // ----------resize for upload------------ int width1 = yourSelectedImageBitmap.getWidth(); int height1 = yourSelectedImageBitmap.getHeight(); </code></pre> <p>You can give a try by this way.After getting the image from the file source or camera.</p> <p>and then by doing this.</p> <pre><code>Matrix matrix1 = new Matrix(); // resize the bit map matrix.postScale(width1, height1); if (exifOrientation.equals("6")) { matrix1.postRotate(90); } Bitmap resizedBitmap1 = Bitmap.createBitmap( yourSelectedImageBitmap, 0, 0, width1, height1, matrix1, true); ByteArrayOutputStream baos = new ByteArrayOutputStream(); resizedBitmap1.compress(Bitmap.CompressFormat.JPEG, 100, baos); byte[] image_bytes = baos.toByteArray(); try { baos.flush(); baos.close(); } catch (IOException e) { e.printStackTrace(); Log.e("~~~~~~~~IOException~~~~~~~~~eeeeee~~~~", "~~~~~~IOException~~~~~~~~~eeeee~~~~" + e.getMessage()); } image_string = Base64.encodeToString(image_bytes, 0); </code></pre> <p>Hope this will help you</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload