Abstract A novel image encryption algorithm based on logistic map is proposed recently. In this paper, a chosen plaintext attack on this algorithm is presented and some other flaws of the algorithm are pointed out. Theoretical analysis and experimental simulation indicate that the plain image can be recovered exactly from the cipher image without secret key. Therefore, this algorithm is not secure enough for practical applications. An improvement is proposed to enhance the security of the original algorithm. Simulation results and theoretical analysis show that the improved scheme has expected cryptographic properties and is more secure than the original algorithm.