An image forming apparatus comprising: an image processing device to compensate at least one of a gray value and a line width of an edge according to an edge type in an input image, wherein the image processing device comprises: a detection unit to detect an edge in an input image; a categorization unit to categorize the edge into an edge type, according to a gray value and a line width associated with the edge; and a compensation unit to compensate at least one of the gray value and the line width according to the categorized edge type, wherein the image is formed of pixels, and the detection unit is arranged to sequentially set each of the pixels as a center pixel, and to determine whether the center pixel is included in an edge by comparing a sum of gray value differences between the center pixel and adjacent ones of the pixels with a predetermined gray threshold value, wherein if the sum is positive, the categorization unit is arranged to categorize the edge as a rising edge, and if the sum is negative, the categorization unit is arranged to categorize the edge as a falling edge, wherein if the line width of the rising edge is less than a predetermined line width threshold value, the categorization unit is arranged to categorize the rising edge as a negative hairline, and if the line width of the falling edge is less than the predetermined line width threshold value, the categorization unit is arranged to categorize the falling edge as a positive hairline, and wherein: if the edge is a rising edge, the compensation unit is arranged to increase a gray value of the rising edge; if the edge is a falling edge, the compensation unit is arranged to decrease a gray value of the falling edge; if the edge is a positive hairline, the compensation unit is arranged to decrease a gray value of the positive hairline; and if the edge is a negative hairline, the compensation unit is arranged to increase a gray value and a line width of the negative hairline. a detection unit to detect an edge in an input image; a categorization unit to categorize the edge into an edge type, according to a gray value and a line width associated with the edge; and a compensation unit to compensate at least one of the gray value and the line width according to the categorized edge type, wherein the image is formed of pixels, and the detection unit is arranged to sequentially set each of the pixels as a center pixel, and to determine whether the center pixel is included in an edge by comparing a sum of gray value differences between the center pixel and adjacent ones of the pixels with a predetermined gray threshold value, wherein if the sum is positive, the categorization unit is arranged to categorize the edge as a rising edge, and if the sum is negative, the categorization unit is arranged to categorize the edge as a falling edge, wherein if the line width of the rising edge is less than a predetermined line width threshold value, the categorization unit is arranged to categorize the rising edge as a negative hairline, and if the line width of the falling edge is less than the predetermined line width threshold value, the categorization unit is arranged to categorize the falling edge as a positive hairline, and if the edge is a rising edge, the compensation unit is arranged to increase a gray value of the rising edge; if the edge is a falling edge, the compensation unit is arranged to decrease a gray value of the falling edge; if the edge is a positive hairline, the compensation unit is arranged to decrease a gray value of the positive hairline; and if the edge is a negative hairline, the compensation unit is arranged to increase a gray value and a line width of the negative hairline.