Use the following convert command:
convert input.jpg -type Grayscale -colorspace Gray -colors 255 -compress None BMP3:output.bmp
Replace convert with magick if your ImageMagick installation doesn't include convert.
In script form for automation:
#!/usr/bin/env bash
if [[ $# -lt 1 ]]
then
echo "Specify filename"
exit 1
fi
while [[ $# -gt 0 ]]
do
from="$1"
to="${1%.*}.bmp"
shift
echo "'$from' -> '$to'"
convert "$from" -type Grayscale -colorspace Gray
-colors 255 -compress None BMP3:"$to"
done
The script can be used in a directory of input files like so: ./pocketbook-convert.sh *.jpg *.png
If the images are already cropped and rotated, ImageMagick can also resize them to the correct size:
convert "$from" \
-gravity center -resize 600x800^ -extent 600x800 \
-type Grayscale -colorspace Gray -colors 255 -compress None BMP3:"$to"
Explanation
Prefix BMP3: is needed to specify version of BMP format, because by default regular BMP is used, which is BMP version 4. See also list of formats via identify -list format:
$ identify -list format | grep BMP
BMP* BMP rw- Microsoft Windows bitmap image
BMP2* BMP rw- Microsoft Windows bitmap image (V2)
BMP3* BMP rw- Microsoft Windows bitmap image (V3)
WBMP* WBMP rw- Wireless Bitmap (level 0) image
I figured out the exact parameters for other options by comparing output of identify -verbose between a good file and a bad file. Also, this answer about DirectClass and PseudoClass helped understand what's going on with color maps and color spaces. Relevant parts of output of identify -verbose:
$ identify -verbose good.bmp | less
Format: BMP3 (Microsoft Windows bitmap image (V3))
Class: PseudoClass
Colorspace: sRGB
Type: Grayscale
Colors: 250
Compression: None
Filesize: 481078B
Filesize is relevant, because with "correct" options, all files have almost exact same size around 470 kilobytes.
Documentation of grayscale BMP conversion options: -type Grayscale, -colorspace Gray, -colors 255, and -compress None.
Documentation of resizing options: -gravity (has to go before -extent!), -resize, -extent.