Shifting RGB values of a single color channel - Printable Version +- Gimp-Forum.net (https://www.gimp-forum.net) +-- Forum: GIMP (https://www.gimp-forum.net/Forum-GIMP) +--- Forum: Extending the GIMP (https://www.gimp-forum.net/Forum-Extending-the-GIMP) +---- Forum: Scripting questions (https://www.gimp-forum.net/Forum-Scripting-questions) +---- Thread: Shifting RGB values of a single color channel (/Thread-Shifting-RGB-values-of-a-single-color-channel) |
Shifting RGB values of a single color channel - tommyfrank - 12-23-2018 Hello, I’m a weaver and textile maker with no prior coding or programming experience. In researching and reading through posts on this and other message boards, I was able to find a lot of useful information, but nothing that I could clearly map on what it is I’m trying to do. I’m hoping someone can steer me in the right direction. I’m working with a set of 18x18 (324px), 8 bit RGB color PNGs which will ultimately be converted into weave structures. I am interested in implementing a script which will allow me to change the value of all pixels of a particular color channel. I’m seeing a number of posts describing how to change the color values of specific pixels, but little about making global changes to the color channels themselves. I want to be able to manipulate each color channel separately. For example, I'd like to be able to edit all RED pixels in an image such that all R pixel values increase by, say, 2, while pixels containing no R remain unchanged. Additionally, I want to be able to specify a limit, e.g. if the maximum R value in the image is 178, all R pixel values equaling 178 will remain unchanged, while all pixels with R values less than 178 will increase in value by 2. I hope to be able to specify the channel (e.g. RED), amount of change (e.g. 2, 1, etc.), type of change (e.g. increase/decrease), and limit (e.g. n = 178, n = 0, n = 255, etc.) as those variables will need to be adjusted to satisfy different color palettes and weave structures. I've tried achieving this in Photoshop and other graphics editors, but outside of selecting like pixels and adjusting their values manually, I haven't had luck in finding an effective solution for this. I’m wondering 1) how feasible this is, 2) what programming language (Python, Java, etc) might provide the most straightforward, expedient solution and 3) if anybody has any tips about how go about writing a script like this (Script-Fu, OpenCV?) as this is all quite new to me. Thanks in advance for your help, TF RE: Shifting RGB values of a single color channel - Ofnuts - 12-23-2018 If you have never coded, this is will be an uphill battle. Otherwise any language with some image library will do. Within Gimp you have the choice between C, Script-fu, and Python. C is powerful but hardcore, Script-fu is a bit alien for most people, Python is a popular language. But maybe you can avoid scripting:
RE: Shifting RGB values of a single color channel - tommyfrank - 12-28-2018 Thank you for your reply. Per your suggestions, I was encouraged to rethink how I might use different blend modes to achieve the desired effect and I think I've come up with a working solution. |