Page 1 of 1
Question on AdjustRGB
Posted: Mon May 06, 2013 9:13 pm
by ElmoDude
Hi,
I am evaluating GD Picture and really need to do just one thing and that is color the white area's of a PNG to a specific RGB value. The adjustRGB value seems to do the trick except the negative values don't correspond with the RGB value I am trying to achieve. What is the formula to accomplish that?
- Hat.png (17.41 KiB) Viewed 5477 times
Thanks,
ElmoDude
Re: Question on AdjustRGB
Posted: Tue May 07, 2013 9:06 am
by SamiKharma
Hi,
The algorithm is pretty straight forward. The values you provide, whether negative or positive, are added to the specific color channel you want. Resulting in an increase in that color channel if the values are positive, and a decrease if the values are negative.
I hope this clarifies it a little bit more for you,
Best,
Sami
Re: Question on AdjustRGB
Posted: Tue May 07, 2013 4:36 pm
by ElmoDude
The algorithm is pretty straight forward.
There not quite that straight forward because there are no negative RGB Values. For example, how would I change the white to say R: 255 G: 255 B:0 like the sample above. Setting positive values don't work because the darker color component is then eliminated.
- Cap.png (10.7 KiB) Viewed 5470 times
Re: Question on AdjustRGB
Posted: Tue May 28, 2013 6:42 pm
by ElmoDude
If I can get an answer on how to do this, or an alternative way, I will buy the control.
Hopefully this will clarify, I need to recolor the lighter shades to specific RGB values while keeping the darker shades.
Re: Question on AdjustRGB
Posted: Wed May 29, 2013 9:22 am
by SamiKharma
Hi,
There not quite that straight forward because there are no negative RGB Values.
Please see my answer before:
The values you provide, whether negative or positive, are added to the specific color channel you want.
I will explain further:
Say you have a color white(255, 255, 255), and you supply values of 0, 0, -255 to the function, you will end up with a color of (255, 255, 0). But you also have to remember that this affects all the colors, meaning that if there is another color in the image: (255, 0, 50), the result will be (255, 0, 0) -since the value is clamped between 0 and 255.
If you want to swap a specific color and not all the colors of the image with another specific color, you'd be better off using:
https://www.gdpicture.com/guides/gdpicture/v9/html/con ... aging.html
I hope this helps.
Best,
Sami
Re: Question on AdjustRGB
Posted: Mon Jul 15, 2013 9:53 pm
by ElmoDude
Thanks Sami. I did purchase the control and your solution kind of worked. I had to add an extra step of merging the original back over the one with the changed color, but it does work great.
Re: Question on AdjustRGB
Posted: Tue Jul 16, 2013 2:39 pm
by SamiKharma
Hi,
I'm glad it worked out.
Thank you for the return.
Best,
Sami