Digital B&W Conversion (GIMP)

The pseudogrey scheme, as described in PseudoGrey: 1786 Shades of Grey , can be implemented with ImageMagick like this. First, we create a CLUT (colour look-up table), with 3 channels, 4096x1 pixels:

magick ^
  -size 4096x1 xc: ^
  -fx (i-7)/w ^
  -channel R ^
    -fx "i%%16>=5&&i%%16<=8?u+1/256:u" ^
    -fx "i%%16>=14&&i%%16<=15?u+1/256:u" ^
  +channel ^
  -channel G -fx "i%%16>=9?u+1/256:u" +channel ^
  -channel B ^
    -fx "i%%16>=2&&i%%16<=4?u+1/256:u" ^
    -fx "i%%16>=7&&i%%16<=8?u+1/256:u" ^
    -fx "i%%16>=11&&i%%16<=13?u+1/256:u" ^
  +channel ^
  -depth 8 ^
  pg_clut.png

This CLUT has 1786 unique colours.

We can use it by applying it to any grayscale image with any number of bits/pixel. We must save the result with a depth of 8. For example:

magick ^
  toes.png ^
  -colorspace Gray ^
  pg_clut.png ^
  -clut ^
  -depth 8 ^
  toes_1786.png

The above commands are for Windows BAT. For bash, change line ends to backslash, don’t double the %%, and escape parentheses ( and ):

magick \
  -size 4096x1 xc: \
  -fx \(i-7\)/w \
  -channel R \
    -fx "i%16>=5&&i%16<=8?u+1/256:u" \
    -fx "i%16>=14&&i%16<=15?u+1/256:u" \
  +channel \
  -channel G -fx "i%16>=9?u+1/256:u" +channel \
  -channel B \
    -fx "i%16>=2&&i%16<=4?u+1/256:u" \
    -fx "i%16>=7&&i%16<=8?u+1/256:u" \
    -fx "i%16>=11&&i%16<=13?u+1/256:u" \
  +channel \
  -depth 8 \
  pg_clut.png

magick \
  toes.png \
  -colorspace Gray \
  pg_clut.png \
  -clut \
  -depth 8 \
  toes_1786.png