How to recursivelly convert JPEG images to JPEG XL while preserving EXIF metadata?

Hello

I have around 20Gb of old .jpg photos in many subdirectories that I would like to (losslessly) convert to JPEG XL to save space.

I have tried this command:
find . -iname '*.jpg' | while read i; do mogrify -format jxl "$i" && rm "$i"; echo "Converted $i to ${i%.*}.jxl"; done
Which works, but it removes all metadata. Is there any way to preserve it?

The command above uses ImageMagick but I’m open to any alternatives.

Nevermind, I just found XL Converter which does exactly what I need.