You should look at the jpeg/mpeg compression algorithm, definitely contains bits of this idea but uses the actual images as a starting point