It’s complicated because iOS 11 is actually storing tiles of HEVC encoded images in a HEIF container, but there’s a demo using the nokia lib to extract them all, ffmpeg to decode them and then stitching them into a single jpeg with imagemagick in the heiftest repo linked from corrupted HEIC tile when converting to JPEG
We also have a working one you can use by cloning https://github.com/pushd/heif and then:
cmake CMakeLists.txt && make && Bins/heiftojpeg test_001.heic test_001.jpg