@Gargron You mean, with a black or transparent box in the middle? You could use ImageMagick's mogrify command to draw it:
imagemagick.org/script/command

If you want to remove a horizontal or vertical band in the middle, you could use -copy to move the bottom / rightmost rectangle next to the other one, then crop:
imagemagick.org/script/command