How do I resize a Java image?

  • 0
    Hello, there is a small code that squeezes images to a fixed size, I wanted to redo it using inSampleSize, but it did not work. Where did I go wrong?
    Bitmap bitmap = ((BitmapDrawable) evImage.getDrawable()).getBitmap();
    BitmapFactory.Options options = new BitmapFactory.Options();
    options.inSampleSize = 8;
     /* bitmap = Bitmap.createScaledBitmap(bitmap, 514, 686, false); */
    ByteArrayOutputStream stream = new ByteArrayOutputStream();
    bitmap.compress(Bitmap.CompressFormat.JPEG, 20, stream);
    byte[] byteArray = stream.toByteArray();
    ParseFile imageFile = new ParseFile("image.jpg", byteArray);
    eventObj.put(Configs.EVENTS_IMAGE, imageFile);
    Android Anonymous, Dec 10, 2020

  • 1 Answers
  • 0
    It looks like you have set the zoom level, but have not applied it to any picture.
    Mia Greer

Your Answer
To place the code, please use CodePen or similar tool. Thanks you!