Pet*_*ter 10 java android image image-processing
所以我有两个图像存储在Android的SD卡本地,我想将它们组合成一个图像.它很难解释所以我将链接到一张图片,以便更好地举例说明我如何拍摄前两张图片并将它们组合到最后一张图片中.

Hit*_*tel 11
我通常使用Jon Simon的以下函数来组合两个作为参数传递的Bitmap并将组合Bitmap作为输出,
public Bitmap combineImages(Bitmap c, Bitmap s)
{
Bitmap cs = null;
int width, height = 0;
if(c.getWidth() > s.getWidth()) {
width = c.getWidth() + s.getWidth();
height = c.getHeight();
} else {
width = s.getWidth() + s.getWidth();
height = c.getHeight();
}
cs = Bitmap.createBitmap(width, height, Bitmap.Config.ARGB_8888);
Canvas comboImage = new Canvas(cs);
comboImage.drawBitmap(c, 0f, 0f, null);
comboImage.drawBitmap(s, c.getWidth(), 0f, null);
return cs;
}
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
7154 次 |
| 最近记录: |