网络上看了很多的方法都有问题,自己的需求又要做,自己拼凑的写完。
gpuImage = new GPUImage(this);
gpuImage.setFilter(gpuImageFilter);
步骤就是先把list集合的地址转为bitmap,然后gpuImage去处理这个bitmap,处理完再返回bitmap,剩下的你要怎么处理都可以
//这里的setImage里面的参数不能是Uri,有的博客就这么写会导致数据根本对不上,我去看了里面的代码,必须是bitmap类型的才没问题
gpuImage.setImage(stringToBitmap(newPhotoPath));
bitmap = gpuImage.getBitmapWithFilterApplied();
public Bitmap stringToBitmap(String string) { // 将字符串转换成Bitmap类型 Bitmap bitmap = null; try { byte[] bitmapArray; //大图片下要这么处理 bitmap = BitmapFactory.decodeFile(string); } catch (Exception e) { e.printStackTrace(); } return bitmap; }
以上就是主要的代码,有什么这方面不懂的可以私我,虽然我也很菜可以互相学习啊