In this paper, we develop a new color image lossless compression algorithm with bit-error awareness based on a general bi-level block coding method. The proposed method contains three stages. First, a color image in the RGB color space is converted to the YCrCb color space by lossless reversible transformations. Next, predictors in the YCrCb color space are applied to generate the residue sequences. In order to achieve a better image compression ratio, a particle swarm optimization (PSO) algorithm is adopted to search the best combination from the candidates of color transformations and predictors which generate the minimum residue entropy. Third, a new 2-D bi-level block coding is developed to further encode the residue sequences. Comparing with the existing residue coding methods, including 1-D bi-level block coding, interval Huffman coding, and standard Huffman coding, the 2-D bi-level block coding algorithm can improve image compression ratio as well as preserving the bit-error resilience. Finally, the key parameters such as color transformation information, predictor parameters and residue coding parameters are protected using (7, 4) Hamming code in the bit stream before transmission. The performances are validated in terms of compression ratio (CR) and peak signal to noise ratio (PSNR). The compression algorithm with bi-level coding achieves the highest PSNR when the bit-error rate (BER) is larger than 0.001 and maintains an acceptable PSNR for BER less than 0.001. In particular, the compression algorithm using the new 2-D bi-level block coding scheme achieves the highest CR. INDEX TERMS lossless compression, bit-error awareness, general bi-level block coding, particle swarm optimization, (7, 4) Hamming code.