---
title: "切割bitmap"
author: "aliusa"
date: "2011-11-15T16:09:22Z"
tags: []
categories: ["移动开发"]
slug: "bitmap"
draft: false
lastmod: "2011-11-15T16:09:22Z"
id: 1260341
url: "https://aliusa.iteye.com/blog/1260341"
---

```java
Bitmap resource = BitmapFactory.decodeResource(this.getResources(), R.drawable.png);   
 Bitmap bitmap = Bitmap.createBitmap(resource, 0, 0, 100, 100); 
```
  
其中R.drawable.png为图片，Bitmap.createBitmap方法中的五个参数意义分别为：
需要切割的图片资源（bitmap）、
切割起始点的X坐标、
切割起始点的Y坐标、
切割多宽、
切割多高。