The security of digital image attracts much attention recently. A hash-based digital image encryption algorithm has been proposed in Ref. [1]. But both the theoretical analysis and computer simulation show the characteristic of diffusion is too weak to resist Chosen Plaintext Attack and Known Plaintext Attack. Besides, one bit difference of the plain pixel will lead to only one corresponding bit change of the cipher pixel. In our improved algorithm, coupled with self-adaptive algorithm, only one pixel difference of the plain-image will cause changes of almost all the pixels in the cipher-image (NPCR>98.77%), and the unified average changing intensity is high (UACI>30.96%). Both theoretical analysis and computer simulation indicate that the improved algorithm can overcome these flaws and maintain all the merits of the original one.