I'm using Android Studio and I would like to be able to pickup am image from the gallery, resize it and make it fit inside a rounded square (of about 300x300px) by maintening the correct aspect ratio. At the moment, I'm able to resize it and display it as a circle with this code:
FixBitmap = MediaStore.Images.Media.getBitmap(getContentResolver(), uri);
bitmap_to_save = scaleBitmapAndKeepRation(FixBitmap, 320, 320);
RoundedBitmapDrawable roundDrawable = RoundedBitmapDrawableFactory.create(getResources(), bitmap_to_save);
However, I would like to know if it is possible to make the bitmap look like my attached image. Moreover, it would be important for me to resize the image without losing the original aspect ratio.
It is not exactly a well square rounded figure, so I'm not sure that it is possible to do it in Android.
I hope you can help me, thanks!
EDIT: I'm using Picasso library for the moment, and it seems to work. Anyway, I would like to keep always the same picture size (300x300 px) and the aspect ratio. How can I do it?