One of the main areas in image processing is line detection and recognition. Some algorithms for line detection were introduced. However, these algorithms involve expensive operations like floating-point arithmetic and matrix operations. In addition, the number of iterations of these expensive operations is high. Such operations increase the computational time significantly. In this paper, a line recognition algorithm, which involves integer arithmetic only, is introduced. The algorithm uses a formal approach to recognize a line within an image file.