android下图片放大操作
/**
     * change the bitmap size
     * @param src : Bitmap source
     * @return : The scaled bitmap
     */
    private Bitmap scaleBitmap(Bitmap src) {
        int width = src.getWidth();//原来尺寸大小
        int height = src.getHeight();
        final float destSize = 500;//缩放到这个大小,你想放大多少就多少//图片缩放比例,新尺寸/原来的尺寸
        float scaleWidth = ((float) destSize) / width;
        float scaleHeight = ((float) destSize) / height;        Matrix matrix = new Matrix();
        matrix.postScale(scaleWidth, scaleHeight);//返回缩放后的图片
        return Bitmap.createBitmap(src, 0, 0, width, height, matrix, true);
    }

解决方案 »

  1.   

    楼主这应该已经很清楚了,你把图片解析成Bitmap对象作为参数传给scaleBitmap()这个函数,返回值就是你要放大后的图片。
    这里关键是
    final float destSize = 500;//缩放到这个大小,你想放大多少就多少
    这句,看你要返回多大的图片了,我这里举例写的是500像素(宽和高都是500)。
      

  2.   

    楼主这应该已经很清楚了,你把图片解析成Bitmap对象作为参数传给scaleBitmap()这个函数,返回值就是你要放大后的图片。
    这里关键是
    final float destSize = 500;//缩放到这个大小,你想放大多少就多少
    这句,看你要返回多大的图片了,我这里举例写的是500像素(宽和高都是500)。主要是我想把图片放大后再上传到服务器,该怎么弄。可能我写的不清楚吧,我也是Android小白