This paper presents a new approach for image compression using artificial neural networks and gradient descent technology, addressing issues of haziness in decompressed images at high compression rates. The study compares the performance of genetic algorithms and back propagation, ultimately finding that the back propagation algorithm yields better results for image compression while enhancing data security. The results indicate promising applications of neural network-based compression techniques in various fields.