how can resize the original image in android

前端 未结 1 1944
栀梦
栀梦 2021-02-10 18:50

i am working on image ,upload original image in this original image resize the small image this image saved in to database

original image --> resize it (small image )--

相关标签:
1条回答
  • 2021-02-10 19:36

    To do this you'll want to play around with the Bitmap class.

    It has several functions to create new bitmaps form previous ones

    Bitmap bmp2 = Bitmap.createScaledBitmap(bmp, width, height, true);
    

    a full list can be found in the documentation :

    http://developer.android.com/reference/android/graphics/Bitmap.html

    Regarding the save to a database I've never done but it would depend on your server.

    0 讨论(0)
提交回复
热议问题