Graal Forums  

Go Back   Graal Forums > Development Forums > NPC Scripting
FAQ Members List Calendar Today's Posts

Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old 01-24-2014, 03:15 PM
sssssssssss sssssssssss is offline
Cyril Rain
sssssssssss's Avatar
Join Date: May 2003
Location: Texas, USA
Posts: 1,134
sssssssssss will become famous soon enough
Showimg HSL

I didn't see anything for this but figured it wouldnt hurt to ask. Is there a way to set not only the rgb values of an image in showimg, but also hsl values?
__________________
Cyril Rain
Creator and leader of SLX
Admin of Elysium
Elysium's Facebook Page: http://facebook.com/GraalOnlineElysium
Graal Forum Thread: http://forums.graalonline.com...
Graalians Thread: http://www.graalians.com...


Reply With Quote
  #2  
Old 01-24-2014, 03:37 PM
fowlplay4 fowlplay4 is offline
team canada
fowlplay4's Avatar
Join Date: Jul 2004
Location: Canada
Posts: 5,200
fowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond repute
HSL can be used to find RGB, and vice versa.

So convert HSL to RGB:

http://stackoverflow.com/questions/2...lor-conversion

I think someone wrote a function but you should be able to figure it out from that link.
__________________
Quote:
Reply With Quote
  #3  
Old 01-24-2014, 04:40 PM
sssssssssss sssssssssss is offline
Cyril Rain
sssssssssss's Avatar
Join Date: May 2003
Location: Texas, USA
Posts: 1,134
sssssssssss will become famous soon enough
Well, the rgb is ok and all, but trying to change an images colors the saturation is off with just rgb. Maybe im misunderstanding but if im getting the same values for rgb that I'm using now by translating the hsl to rgb its not going to solve that problem i dont think.
__________________
Cyril Rain
Creator and leader of SLX
Admin of Elysium
Elysium's Facebook Page: http://facebook.com/GraalOnlineElysium
Graal Forum Thread: http://forums.graalonline.com...
Graalians Thread: http://www.graalians.com...


Reply With Quote
  #4  
Old 01-24-2014, 05:25 PM
fowlplay4 fowlplay4 is offline
team canada
fowlplay4's Avatar
Join Date: Jul 2004
Location: Canada
Posts: 5,200
fowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond repute
Quote:
Originally Posted by sssssssssss View Post
Well, the rgb is ok and all, but trying to change an images colors the saturation is off with just rgb. Maybe im misunderstanding but if im getting the same values for rgb that I'm using now by translating the hsl to rgb its not going to solve that problem i dont think.
HSL and RGB are the means to the same end.

Go into MSPaints color picker and play with it, you'll notice when you change any of the HSL values it changes the RGB and vice versa.

So when you change RGB you have to update the HSL values and vice versa.
__________________
Quote:
Reply With Quote
  #5  
Old 01-25-2014, 05:54 AM
sssssssssss sssssssssss is offline
Cyril Rain
sssssssssss's Avatar
Join Date: May 2003
Location: Texas, USA
Posts: 1,134
sssssssssss will become famous soon enough
I get what you're saying. What we're doing is we have an image that has 0 saturation. Then we're changing the RGB in graal to the colors we want specifically at specific times. The problem is because the original image has 0 saturation, when the new RGB is set in graal, the color is off. Converting HSL to RGB doesn't seem to help, because it's still RGB in the end, and the saturation is still to low. If we up the saturation, the color is still off. I guess maybe there should be a specific color where this wont happen for the original image? No idea what it should be though.
__________________
Cyril Rain
Creator and leader of SLX
Admin of Elysium
Elysium's Facebook Page: http://facebook.com/GraalOnlineElysium
Graal Forum Thread: http://forums.graalonline.com...
Graalians Thread: http://www.graalians.com...


Reply With Quote
  #6  
Old 01-25-2014, 03:05 PM
callimuc callimuc is offline
callimuc's Avatar
Join Date: Nov 2010
Location: Germany
Posts: 1,015
callimuc is a splendid one to beholdcallimuc is a splendid one to beholdcallimuc is a splendid one to beholdcallimuc is a splendid one to beholdcallimuc is a splendid one to behold
Quote:
Originally Posted by sssssssssss View Post
The problem is because the original image has 0 saturation, when the new RGB is set in graal, the color is off. Converting HSL to RGB doesn't seem to help, because it's still RGB in the end, and the saturation is still to low. If we up the saturation, the color is still off
how about making the saturation like 10 and add some sort of offset into your "hsl converter"?
__________________
MEEP!
Reply With Quote
  #7  
Old 01-25-2014, 04:10 PM
sssssssssss sssssssssss is offline
Cyril Rain
sssssssssss's Avatar
Join Date: May 2003
Location: Texas, USA
Posts: 1,134
sssssssssss will become famous soon enough
That's what I was thinking of doing in a way. Basically just showing a palette for the colors, and then in script adjusting RGB to get as close as possible even tho its not the actual values on the palette.

I was just hoping there was an actual way to just adjust saturation instead of converting HSL-RGB. Thanks yall.
__________________
Cyril Rain
Creator and leader of SLX
Admin of Elysium
Elysium's Facebook Page: http://facebook.com/GraalOnlineElysium
Graal Forum Thread: http://forums.graalonline.com...
Graalians Thread: http://www.graalians.com...


Reply With Quote
  #8  
Old 01-26-2014, 05:08 PM
callimuc callimuc is offline
callimuc's Avatar
Join Date: Nov 2010
Location: Germany
Posts: 1,015
callimuc is a splendid one to beholdcallimuc is a splendid one to beholdcallimuc is a splendid one to beholdcallimuc is a splendid one to beholdcallimuc is a splendid one to behold
converted the link fp4 has been posting into gs2 for lazy people

PHP Code:
function onCreated() {
  echo(
rgb2hsl(2342550));
  echo(
hsl2rgb(19610050));
}


function 
rgb2hsl(rgb) {
  
temp.min(max(temp.r0), 255) / 255;
  
temp.min(max(temp.g0), 255) / 255;
  
temp.min(max(temp.b0), 255) / 255;
  
  
temp.max max(temp.rmax(temp.gtemp.b));
  
temp.min min(temp.rmin(temp.gtemp.b));
  
  
temp.temp.temp.= (temp.max temp.min) / 2;
  
  if (
temp.max != temp.min) {
    
temp.temp.max temp.min;
    
temp.= (temp.0.5 temp./ (temp.max temp.min) : temp./ (temp.max temp.min));
    if (
temp.max == temp.r)
      
temp.= (temp.temp.b) / temp.+ (temp.temp.0);
    else if (
temp.max == temp.g)
      
temp.= (temp.temp.r) / temp.2;
    else
      
temp.= (temp.temp.g) / temp.4;
    
temp./= 6;
  }
  else 
temp.temp.0//achromatic
  
  
return {temp.h*360,temp.s*100,temp.l*100};
}

function 
hsl2rgb(hsl) {
  
temp.min(max(temp.h0), 360) / 360;
  
temp.min(max(temp.s0), 100) / 100;
  
temp.min(max(temp.l0), 100) / 100;
  if (
temp.0) {
    
temp.= (temp.0.5 ? (temp.* (temp.s)) : (temp.temp.- (temp.temp.s)));
    
temp.= (temp.l) - temp.q;
    
    
temp.hue2rgb(temp.ptemp.qtemp.1/3);
    
temp.hue2rgb(temp.ptemp.qtemp.h);
    
temp.hue2rgb(temp.ptemp.qtemp.1/3);
  }
  else 
temp.temp.temp.1//achromatic
  
  
return {temp.r*255temp.g*255temp.b*255};
}
function 
hue2rgb(pqt) {
  if (
temp.0temp.+= 1;
  if (
temp.1temp.-= 1;
  
  if (
temp.1/6) return (temp.+ (temp.temp.p) * temp.t);
  if (
temp.0.5) return temp.q;
  if (
temp.2/3) return (temp.+ (temp.temp.p) * (2/temp.t) * 6);
  return 
temp.p;

__________________
MEEP!
Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +2. The time now is 02:22 AM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.
Copyright (C) 1998-2019 Toonslab All Rights Reserved.