Patent ID: 7650039

Claim:
An image encoding apparatus which receives image data in which one pixel is formed from a plurality of color component data, and losslessly encodes the image data, comprising: predictive encoding means for obtaining predicted values of respective color component data which form input pixel data of interest, by referring to color component data of an encoded pixel near the pixel of interest, and generating predictively encoded data; color counting means for counting the number of colors contained in a plurality of pixel data at encoded pixel positions near the pixel of interest, and generating color count information; vector information generation means for comparing the pixel data of interest with the plurality of pixel data present at the encoded pixel positions near the pixel of interest, and generating-vector information for specifying whether a neighboring pixel having the same color as a color of the pixel of interest exists, and when the neighboring pixel having the same color exists, specifying a position of the neighboring pixel relative to the pixel of interest; vector information encoding means for encoding the vector information; and encoded data generation means for generating encoded data to be output, from encoded data obtained by said predictive encoding means and said vector information encoding means on the basis of the color count information obtained by said color counting means and the vector information obtained by said vector information generation means, wherein when the number of colors represented by the color count information is not more than a predetermined threshold and the vector information represents presence of a neighboring pixel having the same color as the color of the pixel of interest, said encoded data generation means outputs the encoded data generated by said vector information encoding means as encoded data of the pixel of interest, when the number of colors counted by said color counting means is not more than the predetermined threshold and the vector information represents absence of a neighboring pixel having the same color as the color of the pixel of interest, said encoded data generation means outputs, as encoded data of the pixel of interest, the encoded data generated by said vector information encoding means and the predictively encoded data generated by said predictive encoding means, and when the number of colors counted by said color counting means exceeds the predetermined threshold, said encoded data generation means outputs the predictively encoded data generated by said predictive encoding means as encoded data of the pixel of interest.