An easy way ????
Not Gimp, This using ImageMagick command and a grayscale 7 level posterized image.
Outputs this
1289: (0,0,0) #000000 gray(0)
20400: (43,43,43) #2B2B2B gray(43)
29548: (85,85,85) #555555 gray(85)
50923: (128,128,128) #808080 gray(128)
55710: (170,170,170) #AAAAAA gray(170)
200560: (213,213,213) #D5D5D5 gray(213)
2358370: (255,255,255) #FFFFFF gray(255)
Not Gimp, This using ImageMagick command and a grayscale 7 level posterized image.
Code:
magick gray.png -colors 7 -define histogram:unique-colors=true -format "%c" histogram:info:
Outputs this
1289: (0,0,0) #000000 gray(0)
20400: (43,43,43) #2B2B2B gray(43)
29548: (85,85,85) #555555 gray(85)
50923: (128,128,128) #808080 gray(128)
55710: (170,170,170) #AAAAAA gray(170)
200560: (213,213,213) #D5D5D5 gray(213)
2358370: (255,255,255) #FFFFFF gray(255)