# How to convert a (gray level) image array to a contrast array?

**URL:** <https://discourse.julialang.org/t/how-to-convert-a-gray-level-image-array-to-a-contrast-array/71976>\
**Category:** New to Julia\
**Tags:** images\
**Created:** [November 23, 2021, 8:53pm UTC](https://discourse.julialang.org/t/how-to-convert-a-gray-level-image-array-to-a-contrast-array/71976 "2021-11-23T20:53:51Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![RexXI](https://avatars.discourse-cdn.com/v4/letter/r/b4bc9f/32.png) [@RexXI](https://discourse.julialang.org/u/RexXI)\
**Post date:** [November 23, 2021, 8:53pm UTC](https://discourse.julialang.org/t/how-to-convert-a-gray-level-image-array-to-a-contrast-array/71976/1 "2021-11-23T20:53:51Z")

</div>

How would one call for/code a function such that a grey level image, say, “x,” could be converted to a contrast array = “x\_contrast?”

Thanks!

---

<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:** [November 23, 2021, 9:17pm UTC](https://discourse.julialang.org/t/how-to-convert-a-gray-level-image-array-to-a-contrast-array/71976/2 "2021-11-23T21:17:51Z")

</div>

I think you want `ImageFiltering.jl`, and a kernel like

```julia
[
0 -1 0;
-1 4 -1;
0 -1 0
]

```

(From memory, so it might be worth giving “contrast kernel” a Google)

---

<div class="post-metadata">

**Author:** ![RexXI](https://avatars.discourse-cdn.com/v4/letter/r/b4bc9f/32.png) [@RexXI](https://discourse.julialang.org/u/RexXI)\
**Post date:** [November 23, 2021, 9:43pm UTC](https://discourse.julialang.org/t/how-to-convert-a-gray-level-image-array-to-a-contrast-array/71976/3 "2021-11-23T21:43:43Z")

</div>

Would `imadjust` work? – Allegedly, it maps the contrast range -1:1 to the JuliaImages default grayscale range 0:1 ?
