Image compression and restoration incorporating prior knowledge