I did something similar for the ZX Spectrum a few years ago, command line usage was on the cards but never done https://github.com/KodeMunkie/imagetozxspec
Is that for the 128k+ with screen swapping? Definitely doesn't look like I'd expect from 48k Spectrums with the chunky attributes but I've not kept up with the shenanigans people have managed to coerce the machine into...