Share your ideas for the JMP Scripting Unsession at Discovery Summit by September 17th. We hope to see you there!
Choose Language Hide Translation Bar
Highlighted
david707
Level III

What do the numbers returned by << Get Pixels(); correspond to?

Hi,

I have a script that is using

m = img << Get Pixels;

on a greyscale jpg image. The values returned range from about 0 to -13 million. It seems the 0s correspond to "black" and the high minuses to "white". I have been able to successfully use negative values of large magnitude to identify "white" areas of the image. However, I have been asked to document this script including what Get Pixels does. How does it determine these numbers? The scripting index says "If no color designator is specified, a matrix of JSL colors representing the pixel values is returned". What does 'JSL colors' mean exactly? Google has not been useful for this...

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
Craige_Hales
Staff (Retired)

Re: What do the numbers returned by << Get Pixels(); correspond to?

The negative numbers are the RGB values. Try this to see the pattern; run just the hex(...) line to see the following line in the log:

hex( -rgbcolor(0.0,0.0,0.0), "integer")
"00000000" black
//:*/
hex( -rgbcolor(0.0,0.0,1.0), "integer")
"000000FF" blue
//:*/
hex( -rgbcolor(0.0,1.0,0.0), "integer")
"0000FF00" green
//:*/
hex( -rgbcolor(1.0,0.0,0.0), "integer")
"00FF0000" red
//:*/
hex( -rgbcolor(1.0,1.0,1.0), "integer")
"00FFFFFF" white
//:*/
hex( -rgbcolor(0.5,0.0,0.0), "integer")
"00800000" dark red
//:*/
hex( -rgbcolor(0.0,0.25,0.0), "integer")
"00004000" darker green
//:*/
hex( -rgbcolor(0.0,0.0,0.01), "integer")
"00000003" really dark blue

rgbcolor(...) takes a red,green,blue argument and returns one of those negative JSL color values. Make it positive before passing to hex() to make everything clear. The bottom three bytes, represented by two hex digits each, represent the 256 possible levels of r,g,b.

 

Other related questions and answers...

https://www.jmp.com/support/help/14/specify-colors.shtml

https://community.jmp.com/t5/JMP-Blog/Colors-in-JSL/ba-p/29596

https://community.jmp.com/t5/Discussions/RGB-Values-to-Color-Names-in-Data-Table/td-p/9848

https://community.jmp.com/t5/JMP-Scripts/Utility-to-Explore-JMP-Color-Values/ta-p/24149

 

Craige

View solution in original post

1 REPLY 1
Highlighted
Craige_Hales
Staff (Retired)

Re: What do the numbers returned by << Get Pixels(); correspond to?

The negative numbers are the RGB values. Try this to see the pattern; run just the hex(...) line to see the following line in the log:

hex( -rgbcolor(0.0,0.0,0.0), "integer")
"00000000" black
//:*/
hex( -rgbcolor(0.0,0.0,1.0), "integer")
"000000FF" blue
//:*/
hex( -rgbcolor(0.0,1.0,0.0), "integer")
"0000FF00" green
//:*/
hex( -rgbcolor(1.0,0.0,0.0), "integer")
"00FF0000" red
//:*/
hex( -rgbcolor(1.0,1.0,1.0), "integer")
"00FFFFFF" white
//:*/
hex( -rgbcolor(0.5,0.0,0.0), "integer")
"00800000" dark red
//:*/
hex( -rgbcolor(0.0,0.25,0.0), "integer")
"00004000" darker green
//:*/
hex( -rgbcolor(0.0,0.0,0.01), "integer")
"00000003" really dark blue

rgbcolor(...) takes a red,green,blue argument and returns one of those negative JSL color values. Make it positive before passing to hex() to make everything clear. The bottom three bytes, represented by two hex digits each, represent the 256 possible levels of r,g,b.

 

Other related questions and answers...

https://www.jmp.com/support/help/14/specify-colors.shtml

https://community.jmp.com/t5/JMP-Blog/Colors-in-JSL/ba-p/29596

https://community.jmp.com/t5/Discussions/RGB-Values-to-Color-Names-in-Data-Table/td-p/9848

https://community.jmp.com/t5/JMP-Scripts/Utility-to-Explore-JMP-Color-Values/ta-p/24149

 

Craige

View solution in original post

Article Labels

    There are no labels assigned to this post.