0

After I do an image capture intent or gallery pick intent, I receive the selected image. This image I want to resize to certain sizes the selected image and get it as new File in order to send it to server. Is possible to achieve this thing ?? Is there any library that can give you such feature ?

vasile
  • 505
  • 1
  • 4
  • 11

1 Answers1

2

you can use Picasso.

Picasso
.with(context)
.load(UsageExampleListViewAdapter.eatFoodyImages[0])
.resize(600, 200) // resizes the image to these dimensions (in pixel). does not respect aspect ratio
.into(imageViewResize);

and if you want the file after resize you can work with target

    .into(new Target() {
        @Override
        public void onBitmapLoaded(Bitmap bitmap, Picasso.LoadedFrom from) {
            // send bitmap to server
        }

        @Override
        public void onBitmapFailed(Drawable errorDrawable) {

        }

        @Override
        public void onPrepareLoad(Drawable placeHolderDrawable) {

        }
    });

onBitmapLoaded give you bitmap and this what you need to send to server

Yoni
  • 1,346
  • 3
  • 16
  • 38