smallest/slowest/effortfullest lossless conversion:
JPG/PNG/TIFF → WEBP
cwebp -lossless -q 100 -m 6 -progress -o <out> <in>
JPG/PNG/GIF → JXL
cjxl -q 100 -e 9 --brotli_effort=11 <in> <out>
JPG/PNG → AVIF
avifenc -l -s 0 <in> <out>
GIF/BMP/TIFF → PNG
optipng -o5 -out <out> <in>
There are -o6 and -o7 settings, but from the docs they seem unlikely to help. See also: A guide to PNG optimization.