We propose several methods to transplant the compound chaotic image encryption scheme with permutation based on three-dimensional (3-D) baker onto image formats such as the joint photographic experts group (JPEG) and graphics interchange format (GIF). The new methods avert the discrete cosine transform and quantization, which result in floating point precision loss, and succeed to encrypt and decrypt JPEG images lossless. The ciphered JPEG images generated by our solution own much better randomness than most other existing schemes. Our proposed method for GIF keeps the property of animation successfully. The security test results indicate the proposed methods have high security, and the speed of our algorithm is faster than classical solutions. Since JPEG and GIF image formats are popular contemporarily, we show that the prospect of chaotic image encryption is promising.