Question on AdjustRGB

Discussions about image processing and document imaging.
Post Reply
ElmoDude
Posts: 7
Joined: Mon May 06, 2013 9:07 pm

Question on AdjustRGB

Post by ElmoDude » Mon May 06, 2013 9:13 pm

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
Hat.png (17.41 KiB) Viewed 5381 times
Thanks,

ElmoDude

SamiKharma
Posts: 352
Joined: Tue Sep 27, 2011 11:47 am

Re: Question on AdjustRGB

Post by SamiKharma » Tue May 07, 2013 9:06 am

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

ElmoDude
Posts: 7
Joined: Mon May 06, 2013 9:07 pm

Re: Question on AdjustRGB

Post by ElmoDude » Tue May 07, 2013 4:36 pm

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
Cap.png (10.7 KiB) Viewed 5374 times

ElmoDude
Posts: 7
Joined: Mon May 06, 2013 9:07 pm

Re: Question on AdjustRGB

Post by ElmoDude » Tue May 28, 2013 6:42 pm

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.

SamiKharma
Posts: 352
Joined: Tue Sep 27, 2011 11:47 am

Re: Question on AdjustRGB

Post by SamiKharma » Wed May 29, 2013 9:22 am

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

ElmoDude
Posts: 7
Joined: Mon May 06, 2013 9:07 pm

Re: Question on AdjustRGB

Post by ElmoDude » Mon Jul 15, 2013 9:53 pm

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.

SamiKharma
Posts: 352
Joined: Tue Sep 27, 2011 11:47 am

Re: Question on AdjustRGB

Post by SamiKharma » Tue Jul 16, 2013 2:39 pm

Hi,

I'm glad it worked out.
Thank you for the return.

Best,
Sami

Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest