Since your source is already grayscale, you can get huge wins by:
- Converting to an 8-bit gray PNG only (no Red/Green/Blue channels)
- Reducing the number of gray‐levels (quantizing)
- Losslessly repacking with Zopfli
Here’s a minimal CLI pipeline (Ubuntu) that should take your ~11 MiB → ~7 MiB (or less):
sudo apt update
sudo apt install imagemagick pngquant zopfli
1) Convert to 8-bit gray
Make sure you drop any 16-bit / extra channels:
convert input.png -colorspace Gray -depth 8 gray8.png
2) Quantize gray-levels
You said “I don’t mind lossy,” so let’s drop to, say, 64 levels of gray.
Tweak --colors downward if you still exceed 7 MiB:
pngquant --speed=1 --quality=60-80 --colors=64 \
--output quant.png gray8.png
3) Zopfli-repack
Squeeze every last byte out of the Deflate stream:
zopflipng --iterations=300 quant.png final.png
4) Verify & iterate
du -h final.png # see compressed size
If you’re still above 7 MiB, rerun step 2 with fewer colors (32, 16, even 8).
Optional one-liner loop
For quick experimentation, save this as shrink-gray.sh and run ./shrink-gray.sh input.png 7:
#!/usr/bin/env bash
IN=$1
TARGET=$(( $2*1024*1024 ))
for C in 64 32 16 8; do
convert "$IN" -colorspace Gray -depth 8 gray8.png
pngquant --speed=1 --quality=50-80 --colors=$C \
--output quant.png gray8.png
zopflipng --iterations=200 quant.png out.png
SZ=$(stat -c%s out.png)
echo "colors=$C → $(du -h out.png | cut -f1)"
if [ $SZ -le $TARGET ]; then
mv out.png "${IN%.png}.shrunk.png"
echo "✅ Success: ${IN%.png}.shrunk.png"
exit 0
fi
done
echo "❌ Too big—try fewer colors or drop resolution."
exit 1
That loop will try 64, 32, 16, then 8 gray-levels and stop once you hit your target. Good luck! 🚀