https://news.ycombinator.com/item?id=22245788
Also, Google has a "brunsli" library, that can recompress JPEG to JPEG XL format without loss.
https://google.github.io/brunsli/