Color Conversion - RGB to HSV and back... (almost)

2017-04-26 Thread Alejandro Tejada via use-livecode
Hi Mike,

Many thanks for posting a link to your
compilation stack: Master Library.

How many new LiveCode users are aware of this
wonderful resource? Thanks again for posting this.

Sorry for replying so late, but recently I am not feeling well.
Food intoxication is my educated guess... :(
Because of this, I have been posting only to the forums,
where I could edit or delete my own messages that
do not say what I meant. :)

Your HSV and RGB conversion functions works great
with only a few changes:

In Function HSVtoRGB this line:

put var_2  var_R
should be
put var_2 into var_R

and

put abs(trunc(var_R * 255)) into R  //RGB results from 0 to 255
put abs(trunc(var_G * 255)) into G
put abs(trunc(var_B * 255)) into B

works better if we replace trunc() for round().

After this small change, HSV is converted
back to RGB with 100% precision. :D

By the way, I posted a stack in the forums
that converts RGB colors of an image to
HSV colors. After this conversion, JPEG
compression artifacts become much more
evident and some strange patches of color
appears in the most unexpected places. :o

You could download the stack from this forum thread:
http://forums.livecode.com/viewtopic.php?f=10=29172

Now, I am looking for some script that allows
users to replace all 6 HSV color and their 7 gradients
(red to orange, orange to yellow, yellow to green
green to cyan, cyan to blue, blue to magenta,
magenta to red ) with colors of their own selection.

Have a nice weekend.
Keep up your Great Work!

Al
___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


Re: Color Conversion - RGB to HSV and back... (almost)

2017-04-14 Thread Michael Doub via use-livecode
Al,  I wrote some color conversion routines a long time ago. They are in 
the MasterLibrary:


https://www.dropbox.com/s/3wpwn3hfbmpl7sk/MasterLibrary.livecode?dl=0

I cant comment on their ability to not loose precision on a round trip.

-= Mike


On 4/13/17 6:14 PM, Alejandro Tejada via use-livecode wrote:

Hi All,

Download this GUI Stack for Scott Raney's Color Conversion Functions:
RGB to HSV and HSV to RGB from this forum post:
http://forums.livecode.com/viewtopic.php?f=10=29127

Only for certain colors this is a lossy conversion: Once you convert some
RGB colors to HSV, the function HSVtoRGB does not convert them back
exactly as they were before.

Does anyone knows or have created a pair of RGB/HSV color conversion
functions that do not lose (or change) color information?

Thanks in advance!

Al
___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode




___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


Color Conversion - RGB to HSV and back... (almost)

2017-04-13 Thread Alejandro Tejada via use-livecode
Hi All,

Download this GUI Stack for Scott Raney's Color Conversion Functions:
RGB to HSV and HSV to RGB from this forum post:
http://forums.livecode.com/viewtopic.php?f=10=29127

Only for certain colors this is a lossy conversion: Once you convert some
RGB colors to HSV, the function HSVtoRGB does not convert them back
exactly as they were before.

Does anyone knows or have created a pair of RGB/HSV color conversion
functions that do not lose (or change) color information?

Thanks in advance!

Al
___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode