[英]how to achieve effect like photoshop's average blur in android?
I want to do a function like photoshop's average blur (Filter>Blue>Average) 我想做一个像photoshop的平均模糊功能(滤镜>蓝色>平均)
but I tried something like get average color from image in android, but really buggy. 但我尝试了类似的操作,例如从android中的图像中获取平均颜色,但确实有问题。 most image turn out to be black or gray or white.
大多数图像显示为黑色或灰色或白色。
any lib available? 有没有可用的库? or Is there any app can do this?
或是否有任何应用程序可以做到这一点?
the effect just like this. 这样的效果。
If you don't like the color you are getting from the average of the color values, you could try Android's Palette
class. 如果您不喜欢从颜色平均值得到的颜色,可以尝试使用Android的
Palette
类。 The class was made to generate a palette of colors based on the prominent colors of an image to create something like this: 创建该类是基于图像的突出颜色生成调色板,以创建如下所示的内容:
This would have to be done asynchronously from the UI thread: 这必须从UI线程异步完成:
Palette.from(bitmap).generate(new PaletteAsyncListener() {
public void onGenerated(Palette palette) {
// Use generated palette
}
});
You can try the different methods available from the Palette
class (ie getVibrantColor
, getMutedColor
, getDarkVibrantColor
, etc.) to see which returns values you like. 您可以尝试使用
Palette
类中可用的其他方法(即getVibrantColor
, getMutedColor
, getDarkVibrantColor
等),以查看喜欢的返回值。
您可以使用此库使背景或图像模糊不清https://github.com/faradaj/BlurBehind
An interesting question. 一个有趣的问题。 And the answer is not a straight forward one.
答案并非直截了当。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.