I think there's more than one way to do this. But here's a reference and a JMP implementation:
Names Default To Here( 1 );
Web("https://web.stanford.edu/class/cs101/image-6-grayscale.html", JMP Window);
img = Open( "$SAMPLE_IMAGES/tile.jpg", jpg );
win = New Window( "tile(40,40)", img );
{r, g, b} = img << Get Pixels( "rgb" );
// Average the rgb values of each pixel and scale from [0, 1] to [0, 255]
nr = NRow(r);
nc = NCol(r);
r2 = Shape(r, 1, nr*nc);
g2 = Shape(g, 1, nr*nc);
b2 = Shape(b, 1, nr*nc);
g2 = VMean(VConcat(r2, g2, b2));
g = Shape(g2, nr, nc);
g = Round(g*255, 0);
dt = AsTable(g);
dt << setName("Greyscale");