The invention discloses a graphic interchange format (GIF) image encryption method based on a compressed encoding and belongs to the field of digital image encryption. According to an algorithm, encryption is performed by selecting color lists of the GIF image and lempel-ziv-welch (LZW) compressed encoding data. When the color lists are encrypted, a key stream is utilized to mix up values of color components in the color lists, and thereby information of plaintext image color indexes can be hidden; when the LZW encoding data is encrypted, a dictionary used by encoding is subjected to scrambling when dictionary entries are matched according to the features of the LZW compression, so that the scrambling algorithm can self-adaptively and dynamically adjust the encryption intensity according to plaintext features, and the encryption efficiency and the safety are good. According to the GIF image encryption method based on compressed encoding, the GIF compressed encoding design encryption algorithm is combined, simultaneously the safety of the GIF image color indexes and the image compressed data is considered, the GIF image color indexes and the image compressed data are respectively encrypted, and good safety is achieved. After the encryption operation is introduced, the GIF image compressed effect is not affected, and the format compatibility of original GIF images is maintained.