Jump to content

Convert RGB to HSL and HSL to RGB as live filter


NotMyFault

Recommended Posts

Hi,

 

after quite a bit of experimenting i finally found a working live filter to convert RGB into HSL, and back to RGB.

The HSL values are stored in RGB channels, and must be interpreted accordingly (e.g. multiply R by 360 to get the classical 0-360 degree for hue). H in R, S in G, L in B.

This will allow you to access individual channels (hue, saturation, and luminosity), and modify independently, or use for intelligent masking / filtering.

The formulas are based on: https://en.wikipedia.org/wiki/HSL_and_HSV#From_RGB

Please use RGB/16 to avoid rounding / banding issues, even if the formula are only capable to convert RGB/8 color data.

Use it at own risk, and have fun with it.

Purposes:

  • Create mask or selections based on
  • hue
  • saturation 
  • luminosity 
  • upper / lower bounds of these values
  • and combination of above (and, or)

 

  • create 2 dimensional charts of one fixed and two variable parameters of the three, e.g. all possible  hue / saturation values for fixed luminosity of 50%

 

  • modify saturation (independent from hue / lum)
  • modify luminosity (independent from hue / sat)
  • modify hue (independent from sat / lum)
  • swap HSL channels 
  • invert HSL channels

Update:

New Version, now working with V2

preset file for easy import into PT filter presets 

 

RGB HSL PT filter.aftoolpresets perfect RGB HSL RGB conversion with test image V2.afphoto

Edited by NotMyFault
New Version

Mac mini M1 A2348 | Windows 10 - AMD Ryzen 9 5900x - 32 GB RAM - Nvidia GTX 1080

LG34WK950U-W, calibrated to DCI-P3 with LG Calibration Studio / Spider 5

iPad Air Gen 5 (2022) A2589

Special interest into procedural texture filter, edit alpha channel, RGB/16 and RGB/32 color formats, stacking, finding root causes for misbehaving files, finding creative solutions for unsolvable tasks, finding bugs in Apps.

My posts focus on technical aspects and leave out most of social grease like „maybe“, „in my opinion“, „I might be wrong“ etc. just add copy/paste all these softeners from this signature to make reading more comfortable for you. Otherwise I’m a fine person which respects you and everyone and wants to be respected.

 

Link to comment
Share on other sites

  • 1 year later...

I checked the PT filter, it does not work in V2 under MacOS, as some of the variable names are now reserved. Will provide an update soon.

Mac mini M1 A2348 | Windows 10 - AMD Ryzen 9 5900x - 32 GB RAM - Nvidia GTX 1080

LG34WK950U-W, calibrated to DCI-P3 with LG Calibration Studio / Spider 5

iPad Air Gen 5 (2022) A2589

Special interest into procedural texture filter, edit alpha channel, RGB/16 and RGB/32 color formats, stacking, finding root causes for misbehaving files, finding creative solutions for unsolvable tasks, finding bugs in Apps.

My posts focus on technical aspects and leave out most of social grease like „maybe“, „in my opinion“, „I might be wrong“ etc. just add copy/paste all these softeners from this signature to make reading more comfortable for you. Otherwise I’m a fine person which respects you and everyone and wants to be respected.

 

Link to comment
Share on other sites

Updated. Template now works with V2.

Mac mini M1 A2348 | Windows 10 - AMD Ryzen 9 5900x - 32 GB RAM - Nvidia GTX 1080

LG34WK950U-W, calibrated to DCI-P3 with LG Calibration Studio / Spider 5

iPad Air Gen 5 (2022) A2589

Special interest into procedural texture filter, edit alpha channel, RGB/16 and RGB/32 color formats, stacking, finding root causes for misbehaving files, finding creative solutions for unsolvable tasks, finding bugs in Apps.

My posts focus on technical aspects and leave out most of social grease like „maybe“, „in my opinion“, „I might be wrong“ etc. just add copy/paste all these softeners from this signature to make reading more comfortable for you. Otherwise I’m a fine person which respects you and everyone and wants to be respected.

 

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...

Important Information

Terms of Use | Privacy Policy | Guidelines | We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.