bitmap size exceeds 32bits

来源:互联网 发布:淘宝情侣装店铺名称 编辑:程序博客网 时间:2024/06/05 06:19
/**     * scale image     *      * @param org     * @param scaleWidth sacle of width     * @param scaleHeight scale of height     * @return     */    public static Bitmap scaleImage(Bitmap org, float scaleWidth, float scaleHeight) {        if (org == null) {            return null;        }        Matrix matrix = new Matrix();        matrix.postScale(scaleWidth, scaleHeight);        return Bitmap.createBitmap(org, 0, 0, org.getWidth(), org.getHeight(), matrix, true);    }


 

 

 

后来查代码,发现原来是 scale 的比例计算错误,将原图给放大了 20 多倍,导致内存溢出所致,重新修改比例值后就正常了

 

0 0
原创粉丝点击