简体   繁体   English

如何在android中添加图像效果?

[英]How to add image effects in android ?

I am trying to apply effect (sepia, brightness, bloom and other image effects if API for them is available) on an image for my android app. 我试图在我的Android应用程序的图像上应用效果(棕褐色,亮度,绽放和其他图像效果,如果它们的API可用)。 But I am totally unable to get precise and well mannered code or concept for solving such problem. 但是我完全无法获得用于解决此类问题的精确且良好的代码或概念。 Although Android 4.0 (API 14) have build in android.media.effect api in it but I am working in Android 2.1 which have only Bitmap, Drawable, DrawableBitmap etc but i am not getting which to work with. 虽然Android 4.0(API 14)已经内置了android.media.effect api,但我在Android 2.1中工作,它只有Bitmap,Drawable,DrawableBitmap等,但我没有得到它。

I have written lots of image effects here, you can try: http://xjaphx.wordpress.com/learning/tutorials/ 我在这里写了很多图像效果,你可以尝试: http//xjaphx.wordpress.com/learning/tutorials/

Note: the tutorials are meant to explain how image effect algorithms are implemented in the most simple way, it's not recommended for production usage. 注意:本教程旨在解释如何以最简单的方式实现图像效果算法,不建议用于生产用途。

As for Pete Answer I tried all of the classes he made and I'm sorry to be a party pooper but these classes are very slow it took at least 10 sec to process an Image with them. 至于皮特答案,我尝试了他所做的所有课程,我很抱歉成为派对大师,但是这些课程非常慢,至少需要10秒才能用它们处理图像。 in my case I needed to process 5 images before the user can proceed with the flow. 在我的情况下,我需要处理5个图像,然后用户才能继续进行流程。

after a few hours I came across this excellent library,(super easy to integrate with gradle): 几个小时后,我遇到了这个优秀的图书馆,(超级易于与gradle集成):

https://github.com/wasabeef/picasso-transformations https://github.com/wasabeef/picasso-transformations

this is an example of how to use it: 这是如何使用它的一个例子:

 Transformation trans1 = new ContrastFilterTransformation(getActivity(), 1.5f);
                        Transformation trans2 = new BrightnessFilterTransformation(getActivity(), 0.2f);
                        Picasso.with(getActivity()).load(uri)
                                .transform(trans1).transform(trans2).into(imageview3); 

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

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