This invention provides a simple lossless
image compression and decoding method, including: S1,
lossless compression: S1.1, calculate the difference between the current pixel and the previous pixel; determine if the difference is 0? S1.2, if it is 0, update the counter and the next pixel value; if the next pixel is empty, perform Golomb encoding on the counter to S1.4; if not empty, return to S1.1; S1.3, if it is not 0, first perform Golomb encoding on the non-zero Count, then use 5-bit or 8-bit fixed-length encoding for pixels with non-zero differences, and set a 5-bit difference threshold; update the next pixel; if the next pixel is empty, go to S1.4; if not empty, return to S1.1; S1.4, encoding ends; S2, lossless decoding: S2.1,
record the current bit; determine if the current bit is 0? S2.2, if it is 0, then perform 0th order Columbus decoding; then proceed to S2.4; S2.3, if it is not 0, then perform
right shift of the bit by 2+5 or 2+8 bits for decoding, with the first two bits as an identifier, then proceed to S2.4; S2.4, determine if the bit is empty? If yes, end; otherwise, return to S2.1.