如何在位图上应用不同的图像效果(滤镜),如棕褐色,黑白,模糊等? [英] How to apply different image effects (filters) on bitmap like sepia, black and white, blur, etc.?

查看:270
本文介绍了如何在位图上应用不同的图像效果(滤镜),如棕褐色,黑白,模糊等?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我不知道如何对图像应用不同的效果,

I am not having any idea of how to apply different effect on Image,

我见过 EffectFactory 类和效果类有一种方法 apply
但是我不确定在inputTexId和optputTexId中传递什么,以及从哪里获得新的更新的图像,如何在imageView中存储更新的图像,

I have seen the EffectFactory class and Effect class in effect class there is one method apply but I am not sure what to pass in inputTexId and optputTexId, and from where I get the new updated image, how to store the updated image in imageView,

请帮我解决这个问题。
是否有可用于提供图像效果的开源库。

Please help me with how to approach this problem. Is there any opensource library available for providing effects on Image.

谢谢,

推荐答案

我已实施 Jerry的Java图像处理库 即可。对我来说很好。

I have implemented Jerry's Java Image Processing Library. Works fine for me.

下载 AndroidJars

Download AndroidJars.

修改

Bitmap bitmap = BitmapFactory.decodeResource(getResources(), R.drawable.ic_launcher);
//Find the bitmap's width height
int width = AndroidUtils.getBitmapOfWidth(getResources(), R.drawable.ic_launcher);
int height = AndroidUtils.getBitmapOfHeight(getResources(), R.drawable.ic_launcher);
//Create a filter object.
GaussianFilter filter = new GaussianFilter();
//set???? function to specify the various settings.
filter.setRadius(8.5f);
//Change int Array into a bitmap
int[] src = AndroidUtils.bitmapToIntArray(bitmap);
//Applies a filter.
filter.filter(src, width, height);
//Change the Bitmap int Array (Supports only ARGB_8888)
Bitmap dstBitmap = Bitmap.createBitmap(src, width, height, Config.ARGB_8888);

Android-jhlabs

Find more detailed information at Android-jhlabs

这篇关于如何在位图上应用不同的图像效果(滤镜),如棕褐色,黑白,模糊等?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆