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

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

问题描述

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

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

我见过 EffectFactory 类和 Effect 类在效果类中有一种方法 应用但我不确定在 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,

请帮助我解决这个问题.是否有任何开源库可用于为 Image 提供效果.

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天全站免登陆