An image processing system and a mask preparation method able to prepare a mask by simple processing and a program executed in such an image processing system are provided. The substitution code includes a reference to a previous position in the stream of data characters at which is located a substring of data characters that matches the substring of data characters which are being substituted located at the first position. The analog shake detection signal and the analog amplification-resultant signal are converted into a digital shake detection signal and a first digital amplification-resultant signal, respectively.