1. A method for compressing image data in an electronic device, the method comprising: receiving a pixel block having a plurality of pixels, each of the plurality of pixels associated with a color value; generating a pattern database comprising a plurality of entries, the pattern database having a maximum number of available entry locations, a populated entry of the plurality of entries including a database pattern value associated with an index code; performing a pattern search by comparing a pixel pattern value generated from a color value of a searched pixel of the plurality of pixels to the database pattern value of at least a first populated entry in the pattern database; determining whether the pixel pattern value is equal to the database pattern value; associating the searched pixel with the index code in a corresponding populated entry if the pixel pattern value is equal to the database pattern value; updating the pattern database with a new pattern entry based on the color value of the searched pixel if the pixel pattern value is not equal to the database pattern value; terminating the pattern search if the pixel pattern value is not equal to any database pattern value and a number of populated entries in the pattern database equals the maximum number of available entry locations; and performing a slope-enabled pattern search if the pattern search is terminated, wherein the slope-enabled pattern search comprises quantizing color values of each of the plurality of pixels, and performing the pattern search by comparing a quantized color value to the database pattern value of at least a first populated entry in the pattern database.