@bh
I'm processing images that have a bounding box around identified objects and using saturation as the most reliable way of finding the spatial limits of the bounding boxes
I needed a pixel -> HSV fast conversion and found that there are primitives in Snap! 7 to do this so I've produced a modified reporter to take use them
I used this formula in Wikipedia for the HSV -> HSL conversion
hopefully got it right
<blocks app="Snap! 7dev, https://snap.berkeley.edu" version="2"><block-definition s="using primitives ✐ HSL/HSV (hsl? %'HSL?' ) from RGB %'color'" type="reporter" category="pen"><header></header><code></code><translations></translations><inputs><input type="%b">false</input><input type="%s"></input></inputs><script><block s="doIf"><block s="reportNot"><block var="HSL?"/></block><script><block s="doReport"><block s="reportProduct"><l>100</l><block s="reportApplyExtension"><l>clr_hsv(clr)</l><list><block s="reportApplyExtension"><l>clr_rgba(r, g, b, a)</l><list><block s="reportListItem"><l>1</l><block var="color"/></block><block s="reportListItem"><l>2</l><block var="color"/></block><block s="reportListItem"><l>3</l><block var="color"/></block></list></block></list></block></block></block></script></block><block s="doDeclareVariables"><list><l>HSV</l><l>lightness</l><l>saturation</l></list></block><block s="doSetVar"><l>HSV</l><block s="reportApplyExtension"><l>clr_hsv(clr)</l><list><block s="reportApplyExtension"><l>clr_rgba(r, g, b, a)</l><list><block s="reportListItem"><l>1</l><block var="color"/></block><block s="reportListItem"><l>2</l><block var="color"/></block><block s="reportListItem"><l>3</l><block var="color"/></block></list></block></list></block></block><block s="doSetVar"><l>lightness</l><block s="reportProduct"><block s="reportListItem"><l>3</l><block var="HSV"/></block><block s="reportDifference"><l>1</l><block s="reportQuotient"><block s="reportListItem"><l>2</l><block var="HSV"/></block><l>2</l></block></block></block></block><block s="doIfElse"><block s="reportOr"><block s="reportEquals"><block var="lightness"/><l>0</l></block><block s="reportEquals"><block var="lightness"/><l>1</l></block></block><script><block s="doSetVar"><l>saturation</l><l>0</l></block></script><script><block s="doSetVar"><l>saturation</l><block s="reportQuotient"><block s="reportDifference"><block s="reportListItem"><l>3</l><block var="HSV"/></block><block var="lightness"/></block><block s="reportMin"><block var="lightness"/><block s="reportDifference"><l>1</l><block var="lightness"/></block></block></block></block></script></block><block s="doReport"><block s="reportNewList"><list><block s="reportProduct"><l>100</l><block s="reportListItem"><l>1</l><block var="HSV"/></block></block><block s="reportProduct"><l>100</l><block var="saturation"/></block><block s="reportProduct"><l>100</l><block var="lightness"/></block></list></block></block></script></block-definition></blocks>