# Can contrast of juce::Graphics be controled?

**URL:** <https://forum.juce.com/t/can-contrast-of-juce-graphics-be-controled/58888>\
**Category:** General JUCE discussion\
**Created:** [November 20, 2023, 12:49am UTC](https://forum.juce.com/t/can-contrast-of-juce-graphics-be-controled/58888 "2023-11-20T00:49:35Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![pajczur](https://avatars.discourse-cdn.com/v4/letter/p/e9a140/32.png) [@pajczur](https://forum.juce.com/u/pajczur)\
**Post date:** [November 20, 2023, 12:49am UTC](https://forum.juce.com/t/can-contrast-of-juce-graphics-be-controled/58888/1 "2023-11-20T00:49:35Z")

</div>

I know I can get contrasted colour by `Colour::contrasting()`, but I am drawing `juce::Image` so I wonder is there any easy way to change the contrast of drawn `juce::Image` all whole `juce::Component`?

For any help great thanks in advance.

---

<div class="post-metadata">

**Author:** ![timothyschoen](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/timothyschoen/32/14089_2.png) [@timothyschoen](https://forum.juce.com/u/timothyschoen)\
**Post date:** [November 21, 2023, 3:46pm UTC](https://forum.juce.com/t/can-contrast-of-juce-graphics-be-controled/58888/2 "2023-11-21T15:46:27Z")

</div>

You might want to look into juce::Component’s [setComponentEffect](https://docs.juce.com/master/classComponent.html#a06800d0a55016e738c55078d82ef49fd) method.

It allows you to write an effect class that can manipulate all the pixels drawn by a Component directly. Maybe not the most efficient method, but you can create a class derived from ImageEffectFilter that adjusts the contrast of you component. If you need to change your contrast dynamically, this can do that. If not, I’d recommend just using the colours you want to have directly, since that will lead to better performance.
