android - 如何在位图上应用不同的图像效果(滤镜),如棕褐色、黑白、模糊等?

标签 android image-processing android-image image-editing

<分区>

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

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

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

谢谢,

最佳答案

我已经实现了 Jerry's Java Image Processing Library 。对我来说很好用。

下载 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 找到更多详细信息

关于android - 如何在位图上应用不同的图像效果(滤镜),如棕褐色、黑白、模糊等?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16292146/

相关文章:

Android,滑动面板布局与抽屉导航

opencv - 光强度作为曝光和图像亮度的函数

javascript - 高对比度图像过滤器

android - 图像查看器 fragment (Android)

android - 使用 View 翻转器在不同列表中显示相同图像

android - 停止音频播放

android - 调试 android/ios 应用程序 sqlite 数据库

android - 无法导航至主要 Activity

c++ - 如何让 C 方法接受 UIImage 参数?

android - 7 英寸平板电脑和手机的实际图像尺寸