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

发布于 2024-12-29 11:11:42 字数 216 浏览 3 评论 0原文

我正在尝试在我的 Android 应用程序的图像上应用效果(棕褐色、亮度、绽放和其他图像效果(如果 API 可用))。但我完全无法获得精确且有礼貌的代码或概念来解决此类问题。虽然 Android 4.0 (API 14) 内置了 android.media.effect api,但我正在使用 Android 2.1,其中只有 Bitmap、Drawable、DrawableBitmap 等,但我不知道可以使用哪些。

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. 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 e.t.c but i am not getting which to work with.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

阳光下的泡沫是彩色的 2025-01-05 11:11:42

我在这里写了很多图像效果,你可以尝试:http://xjaphx.wordpress.com/ Learning/tutorials/

注意:教程旨在解释如何以最简单的方式实现图像效果算法,不建议用于生产用途。

I have written lots of image effects here, you can try: 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.

执妄 2025-01-05 11:11:42

至于皮特的回答,我尝试了他制作的所有课程,很抱歉成为派对扫兴者,但这些课程非常慢
用它们处理一张图像至少需要 10 秒。就我而言,我需要先处理 5 个图像,然后用户才能继续流程。

几个小时后,我发现了这个优秀的库,(与 gradle 集成非常容易):

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

这是如何使用它的示例:

 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); 

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. in my case I needed to process 5 images before the user can proceed with the flow.

after a few hours I came across this excellent library,(super easy to integrate with gradle):

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); 
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文