Answer the question
In order to leave comments, you need to log in
How to resize a Java image?
Hello, there is a small code that compresses images to a fixed size, I wanted to redo it using inSampleSize, but it didn’t 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);
Answer the question
In order to leave comments, you need to log in
It looks like you've set the zoom out scale, but haven't applied it to any picture.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question