Well, I've come up with something decent, at least for bitmask (black/white) images.
Take bitmap 1:
And bitmap 2:
XOR them together:
Crop edges:
Compress this with PNG or another lossless image codec, which should take care of the large black areas.