In order to ensure the safe and reliable transmission of images on public channels, this paper proposes a dual-domain image encryption algorithm based on a seven-dimensional hyperchaos and dynamic wavelet decomposition. It is worth mentioning that the existing encryption algorithms generally use spatial encryption, which still has shortcomings in encryption security and execution efficiency. However, the combination of dynamic wavelet decomposition and scrambling and diffusion operations is adopted in our algorithm to realize the combination of spatial and frequency domain encryption. Compared with the existing algorithm, this not only ensures the security of the encryption algorithm, but also ensures the robustness and operating efficiency of the encryption, and at the same time reduces the risk of being attacked. First, divide the original image into blocks, use a random number sequence to control the block scrambling process, and generate a scrambling matrix; Then by calculating the Hamming distance related to the plaintext, dynamically selecting the wavelet type, performing wavelet decomposition, and generating a wavelet coefficient matrix; Re-input the plaintext image to the SHA-512 algorithm to generate the initial value of the seven-dimensional hyperchaos. The chaotic system generates the chaotic key matrix through iteration; Then the scrambling matrix is dynamically rotated, and then the Zigzag transform is used to generate the key matrix; Finally, the wavelet coefficient matrix, the chaotic key matrix, and the key matrix are subjected to bitwise XOR operation to realize the diffusion of pixel values and obtain the final encrypted image. Simulation experiments and performance analysis experiments can show that this algorithm can effectively encrypt and decrypt images, and has good encryption and decryption quality. And compared with existing encryption algorithms, it has better security, robustness, operational efficiency and the ability to resist various attacks.