This seems more useful to me than having 0B files.
@effigies showed me how to do this for NIfTIs (see Python code below) but we should have documentation on how to do it for a range of common imaging filetypes in the CONTRIBUTING file.
import io
import gzip
from pathlib import Path
import nibabel as nb
path = Path('/path/to/example/dset').resolve()
for file in path.rglob('*.nii.gz'):
img = nb.load(file)
bio = io.BytesIO()
img.header.write_to(bio)
header = bio.getvalue()
# Write gzipped header for .nii.gz files
with gzip.open(file, 'wb') as f:
f.write(header)