Comment on Could you compress text files by mapping a word to how commonly it is used and translating it with an application?
Jpeg compression is much more complex than what you described. I recommend this video as a primer: youtu.be/0me3guauqOU