You are not logged in.
Hi,
I want to create an application that applies a color effect to the screen.
Like redshift or xrandr are doing gamma correction.
But I want to do something like in gimp colors>map>color_exchange, where you can define a color and a threshold for r, g and b and a 'goal color'.
Then the defined color along with similar colors within the threshold are replaced by the second color.
Is this possible?
Maybe capture the screen and apply an ffmpeg filter, but I couldn't find a color exchange filter.
Thanks for reading.
Last edited by castor (2022-04-11 19:48:50)
Offline
https://en.wikipedia.org/wiki/Linux_color_management
This is your primary search term. You might need to do it twice, Xorg and Wayland are quite different.
Offline
Hi,
At first I didn't like this approach and wanted to rather 'inject' code into the render pipeline.
But now I find it is much simpler to just apply a color profile as you suggested, thanks for that.
However I am having issues on generating and applying them.
I have successfully used xcalib and applied the color profiles that are shipped with it.
Now my question is: If I have this image:
and apply the code
convert blue_red.png -modulate 100,100,10 hue_convert.png(imagemagick: convert -modulate)
I get this image:
Now I have seen the functionality in gimp to create an ICC profile from the image,
But xcalib won't take the profile as input.
Also when I try to use GIMP to apply profiles to an image (eg the bluish.icc shipped with xcalib, or one exported with gimp) the image looks the same to me.
Is it even possible to create 'hue changing' ICC profiles?
Because this seems to me the easiest way to get different colors out of the image, without using complicated filters.
I have skimmed the wiki page about color management, but I didn't find out what is possible and what not.
I get the idea. For example I remember having an ink printer years ago and the outcome was turquoise instead of blue or so.
Just changing color temperature won't make the image colorful, will it?
Thanks for reading.
Last edited by castor (2022-04-11 16:07:50)
Offline
Correct.
Color profiles only allow you to change the value of r,g,b components for source values of r,g,b.
Respectively.
So: r_new=f(r_old)
You can't do r_new=f(r_old,g_old)
Given that limitation, I don't think you can achieve what you want by just using them.
Probably your only hope is to write a glsl shader to inject into a compositor.
AFAIK, picom supports to load and apply glsl shaders from text files easilly.
https://github.com/yshui/picom/wiki/Shader-Shop
Last edited by kokoko3k (2022-04-11 18:19:06)
Help me to improve ssh-rdp !
Retroarch User? Try my koko-aio shader !
Offline
That is also a very good idea, thanks.
Since glsl is a 'global' thing I can write the shader and put it different programs.
Picom, or in applications, games or other.
For the ICC profile approach. Luckily
xcalib -invert -alterdoes almost exactly the same 'color shift' that this does:
convert blue_red.png -modulate 100,100,10 hue_convert.pngHowever I can't show it to you, at least not via screencast software, because it changes the color on a lower level, or is there a screen capture software that acts on a lower level?
Still the invert function of xcalib is very nice, just for fun.
Offline
Yeah, i know the effect.
The brighter the input component, the darked the output one will be, it is color inversion (i used it at night to dim the screen and keep browsing while my wife was sleeping).
I think you can mark the thread as solved (?)
Last edited by kokoko3k (2022-04-11 19:17:59)
Help me to improve ssh-rdp !
Retroarch User? Try my koko-aio shader !
Offline
Yep, solved.
--> Use xcalib or other ICC / gamma correction software for quick effects. (Might be able to optimize this). I mean it might be possible to change the colors on a hue change basis. But probably not.
--> Use glsl shader for picom / other glsl compatible render software.
One useful resource:
Xorg render doc
Modern applications use a variety of client side rendering libraries, such as Cairo for rendering 2D images or OpenGL for 3D rendering. These may then push images to the X server for display, or use DRI to bypass the X server and interact directly with local video hardware, taking advantage of GPU acceleration and other hardware features.
Eg. Alacritty uses GPU acceleration. So it might even be possible to inject the gsls shader directly into alacritty.
Thanks
Offline
Found this one for kwin:
https://github.com/kevinlekiller/kwin-effect-shaders
Seems to work ok in wayland, has problems in showing the gui in Xorg, but the shaders do work there too.
Help me to improve ssh-rdp !
Retroarch User? Try my koko-aio shader !
Offline