# How to generate a multi-color blur gradation from a specified image?

**URL:** https://discourse.processing.org/t/how-to-generate-a-multi-color-blur-gradation-from-a-specified-image/22779
**Category:** Coding Questions
**Tags:** homework
**Created:** [July 22, 2020, 11:33am UTC](https://discourse.processing.org/t/how-to-generate-a-multi-color-blur-gradation-from-a-specified-image/22779 "2020-07-22T11:33:15Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![Soh](https://avatars.discourse-cdn.com/v4/letter/s/96bed5/32.png) [@Soh](https://discourse.processing.org/u/Soh)
#### Post date: [July 22, 2020, 11:33am UTC](https://discourse.processing.org/t/how-to-generate-a-multi-color-blur-gradation-from-a-specified-image/22779/1 "2020-07-22T11:33:15Z")

</div>

Is there any possible way to generate a multi-color blur gradation depends on an image via Processing?  
For example, the lyrics UI background of Apple Music. It’s auto-generated from CD jacket image.

 ![IMG_9964.PNG](https://canada1.discourse-cdn.com/flex036/uploads/processingfoundation1/original/2X/a/acc5a1c6a88666fa11b833e75c7cf1571ed33255.jpeg)

---

<div class="post-metadata">

### Author: ![jb4x](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/jb4x/32/789_2.png) [@jb4x](https://discourse.processing.org/u/jb4x)
#### Post date: [July 22, 2020, 11:53am UTC](https://discourse.processing.org/t/how-to-generate-a-multi-color-blur-gradation-from-a-specified-image/22779/2 "2020-07-22T11:53:08Z")

</div>

Hello @Soh,

The way I would go about it would be to first do some [color quantization](https://en.wikipedia.org/wiki/Color_quantization) of your main image. With that process you should be left with 2 or 3 main colors.

Then, I would use some [voronoi](https://en.wikipedia.org/wiki/Voronoi_diagram) like method to randomly fill the space with the 2 or 3 previously found colors.

Finally, I would apply a [gaussian blur](https://en.wikipedia.org/wiki/Gaussian_blur) using a really big radius to soften all the transition a have nice gradients.

Really cool project, I might also give it a go if I have time 😁

---

<div class="post-metadata">

### Author: ![glv](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/glv/32/18785_2.png) [@glv](https://discourse.processing.org/u/glv)
#### Post date: [July 22, 2020, 1:03pm UTC](https://discourse.processing.org/t/how-to-generate-a-multi-color-blur-gradation-from-a-specified-image/22779/3 "2020-07-22T13:03:44Z")

</div>

Hello,

One of the best tools in a programmers tool chest is knowing the resources available to you and learning to navigate, filter and use them.

This is a very short list:

> **Resources \< Click here to expand !**
>
> I encourage you to review the resources available here:
> 
> - The Processing _website_ has references, examples, tutorials, etc.  
> [https://processing.org/](https://processing.org/)
> - The Processing PDE (IDE) has lots to offer!  
> An exploration of the tabs will reveal what is available; libraries, tools and local examples there.
> - The Coding Train  
> [https://www.youtube.com/channel/UCvjgXvBlbQiydffZU7m1\_aw](https://www.youtube.com/channel/UCvjgXvBlbQiydffZU7m1_aw)  
> [https://thecodingtrain.com/](https://thecodingtrain.com/)
> - Happy Coding  
> [Processing Tutorials - Happy Coding](https://happycoding.io/tutorials/processing/)
> - The source code can give insight if you are adventurous:  
> [GitHub - processing/processing: Source code for the Processing Core and Development Environment (PDE)](https://github.com/processing/processing)  
> Many of the Processing functions are here:  
> [processing/core/src/processing/core/PApplet.java at master · processing/processing · GitHub](https://github.com/processing/processing/blob/master/core/src/processing/core/PApplet.java)
> - The Processing Foundation  
> [https://processingfoundation.org/](https://processingfoundation.org/)  
> Check out the tabs.  
> In the education tab, there is a reference to the Coding Train.
> - And the Internet. `:)`

From above:

> **[Blur / Examples](https://processing.org/examples/blur.html)**
>
> A low-pass filter blurs an image. This program analyzes every pixel in an image and blends it with the neighboring pixels to blur the image.

> **[filter() / Reference](https://processing.org/reference/filter_.html)**
>
> Filters the image as defined by one of the following modes: THRESHOLD Converts the image to black and white pixels depending on if they are above or below the threshold defined by the …

> **[filter() / Reference](https://processing.org/reference/pimage_filter_)**
>
> Filters the image as defined by one of the following modes: THRESHOLD Converts the image to black and white pixels depending on if they are above or below the threshold defined by the …

> **[PShader / Reference](https://processing.org/reference/pshader)**
>
> This class encapsulates a GLSL shader program, including a vertex and a fragment shader. It is compatible with P2D and P3D, but not with the default renderer. Use the loadShader() function to l…

I stopped there…

`:)`
