简体   繁体   English

在Android中提取位图的顶部

[英]Extract top part of bitmap in android

是否有一种简单的方法可以提取位图的顶部(如附件图像)并仅获取位图的底部?

It is quite easy actually. 实际上,这很容易。 You have to use the method; 您必须使用该方法;

Bitmap dest=Bitmap.createBitmap(Bitmap source, int x, int y, int width, int height);

Here x and y are coordinates of starting points. 在此,x和y是起点的坐标。 In your case you want to set x to 0, y to something, width to the real width and height to a shorter one. 您需要将x设置为0,将y设置为y,将宽度设置为实际宽度,将高度设置为较短的高度。 Beware that the width and height you enter cannot be larger than the original bitmap's dimensions. 请注意,您输入的宽度和高度不能大于原始位图的尺寸。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM