# Simple function to blur an image?

**URL:** <https://discourse.julialang.org/t/simple-function-to-blur-an-image/66417>\
**Category:** Specific Domains\
**Tags:** images\
**Created:** [August 15, 2021, 3:21am UTC](https://discourse.julialang.org/t/simple-function-to-blur-an-image/66417 "2021-08-15T03:21:51Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![NHDaly](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/nhdaly/32/1413_2.png) [@NHDaly](https://discourse.julialang.org/u/NHDaly)\
**Post date:** [August 15, 2021, 3:21am UTC](https://discourse.julialang.org/t/simple-function-to-blur-an-image/66417/1 "2021-08-15T03:21:51Z")

</div>

Hi all - today i found myself wanting to blur an image, and i figured it should be easy to find an example online. But I wasn’t able to find one…

I’m sure that i’m just not searching for the right terms, because I am _by no means_ an expert in image processing - maybe i needed to search for “Gaussian filter” or some other fancy sounding words like that?

Anyway, in lieu of any better answers, I wrote this really naive blur function that I posted to stack overflow, here:  
[https://stackoverflow.com/questions/68788453/how-can-i-blur-an-image-in-julia-with-a-simple-function/68788454#68788454](https://stackoverflow.com/questions/68788453/how-can-i-blur-an-image-in-julia-with-a-simple-function/68788454#68788454)

It’s obviously terrible, though, for a bunch of reasons. It’s slow, and it looks bad.

Can people who know more about math and algorithms and image processing come suggest better answers to the question? 🙂

🙏 thanks everyone!

---

<div class="post-metadata">

**Author:** ![NHDaly](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/nhdaly/32/1413_2.png) [@NHDaly](https://discourse.julialang.org/u/NHDaly)\
**Post date:** [August 15, 2021, 3:23am UTC](https://discourse.julialang.org/t/simple-function-to-blur-an-image/66417/2 "2021-08-15T03:23:54Z")

</div>

Heh, the downvotes have already started. Gotta love StackOverflow, y’all

---

<div class="post-metadata">

**Author:** ![NHDaly](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/nhdaly/32/1413_2.png) [@NHDaly](https://discourse.julialang.org/u/NHDaly)\
**Post date:** [August 15, 2021, 3:25am UTC](https://discourse.julialang.org/t/simple-function-to-blur-an-image/66417/3 "2021-08-15T03:25:38Z")

</div>

I vaguely think I remember this was covered in the MIT computational thinking course? 🤔 I probably should have gone back there and had a look! 😅

---

<div class="post-metadata">

**Author:** ![gustaphe](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/gustaphe/32/18174_2.png) [@gustaphe](https://discourse.julialang.org/u/gustaphe)\
**Post date:** [August 15, 2021, 4:48am UTC](https://discourse.julialang.org/t/simple-function-to-blur-an-image/66417/4 "2021-08-15T04:48:07Z")

</div>

Have you looked at [ImageFiltering.jl](https://juliaimages.org/ImageFiltering.jl/stable/)?

---

<div class="post-metadata">

**Author:** ![cormullion](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/cormullion/32/49131_2.png) [@cormullion](https://discourse.julialang.org/u/cormullion)\
**Post date:** [August 15, 2021, 9:53am UTC](https://discourse.julialang.org/t/simple-function-to-blur-an-image/66417/5 "2021-08-15T09:53:24Z")

</div>

Something like this works for me.

```julia
img = load(imfilename)
imgg = imfilter(img, Kernel.gaussian(1))

```

where you’d increase the value to go blurrier.

I can’t remember which of the Images packages you need to load first…
