In some chaos-based image encryption algorithms, the key is not related to the plaintext and the chaotic sequence has periodicity. In order to solve these problems, a new image encryption method is proposed. First, based on the plaintext image and the hash function SHA-384, the initial value of the Lorenz is generated, and the chaotic system is controlled to generate chaotic sequences. Then, the artificial neural network is introduced to train the chaotic sequence to eliminate its chaotic periodicity and output a new sequence. The scrambling and diffusion operations are performed on the plaintext image to complete the encryption. The experimental results show that the proposed algorithm is able to enhance the security of the cipher-image, increase the size of the key space and resist various attacks.