Android的处理内存溢出异常图像处理图像处理、异常、内存、Android

由网友(时光偷走初心)分享简介:这是这个问题的序列部分:http://stackoverflow.com/questions/3674441/combining-2-images-overlayedThis is the sequence part of this question: http://stackoverflow.com/questio...

这是这个问题的序列部分:http://stackoverflow.com/questions/3674441/combining-2-images-overlayed

This is the sequence part of this question: http://stackoverflow.com/questions/3674441/combining-2-images-overlayed

所以这个问题是:如果图像尺寸过大 - 它会得到一个异常(内存溢出异常) 我要的是,处理即使手机拿到了低规格硬件,它不会去那个异常(但它会需要更长的时间来处理图像)

so the problem is: if the image size is too big - it'll got an exception (out of memory exception) what i want is, to handle even if the handset got the lower spec hardware, it doesn't go to that exception (but it'll take a longer time to process the image)

是有可能做到这一点?

在code段是这样的:

the code snippet is like this:

public static Bitmap overlay(Bitmap bmp1, Bitmap bmp2) {
    Bitmap bmOverlay = Bitmap.createBitmap(bmp1.getWidth(), bmp1.getHeight(), bmp1.getConfig());
    Canvas canvas = new Canvas(bmOverlay);
    canvas.drawBitmap(bmp1, new Matrix(), null);
    canvas.drawBitmap(bmp2, 0, 0, null);
    return bmOverlay;
}

和code表示块是异步任务里。

and that block of code is inside the async task.

我真的AP preciate如果有人能帮助我在这个问题上。

I really appreciate if someone can help me on this matter.

感谢您和问候, 和

推荐答案

我觉得你没有选择,而是要重新调整位图在一个较低的尺寸......

I think you have no choice, but to rescale the bitmaps in a lower size...

阅读全文

相关推荐

最新文章