Patent ID: 6970596

Claim:
A method for compressing an image by classifying colors, wherein said method comprises: collecting a photo image, said photo image comprising plural data, such as: a first row data, a second row data, and a third row data, . . . , and a mth row data, wherein each of said plural row data comprises plural pixels, such as: a first pixel, a second pixel, a third pixel, . . . , and a nth pixel, and said plural pixels are showed in a RGB coordinate; transforming said plural pixels from said RGB coordinate to become a Lab coordinate; processing said plural row data in turn in a row data compressing process, wherein said row data compressing process comprises: proceeding said plural pixels in turn in a pixel compressing process, wherein said pixel comprising process comprises: determining a memory if there are datum in said memory or not; saving any of said plural pixels in said memory to become a first data when there is no said datum in said memory; calculating a first difference between said any of said plural pixels and said first data when said first data are in said memory, wherein said first difference is a minimum first difference when said first data are an only one pixel value; collecting said minimum first difference from said plural first differences; classifying said any pixel as same sort as a pixel which is corresponding to said minimum first difference and saving an index value of said any pixel when said minimum first difference is lower than said first set value; calculating plural second difference between said any pixel and a pixel whose location is the same row and the preceding column of said any pixel, said any pixel and a pixel whose location is the same column and the preceding row of said any pixel, and said any pixel and the preceding row and the preceding column of said any pixel when said minimum first difference is not lower than said first set value, wherein a minimum second difference is got from said plural second difference; comparing said minimum second difference and a second set value; classifying said any pixel as same sort as a pixel which is corresponding to said minimum second difference and saving the index value of said any pixel when said minimum second difference is lower than said second set value; saving said any pixel in said memory to become said first data when said minimum second difference is not lower than said second set value; saving said plural pixels in said memory; and saving said plural pixel in said memory.