In contrast to the numerous edge-detection techniques that detect edges either point by point or using overlapping circular windows, an edge detector using nonoverlapping rectangular windows is proposed. The detector examines the pixels within each rectangular window of an image, and decides whether an edge element is present or not in the window. Based on the gray and mass moment-preserving principles, the step edge is estimated locally to subpixel accuracy using analytical formulas. To apply the edge detection results to image compression, the detected edge elements are then tracked and grouped based on proximity and orientation. Using the line parameters of the grouped edge elements, region boundaries are approximated in a piecewise linear manner. This reduces the amount of data required to describe region shapes and is useful for compressing some types of images. Good experimental results of compressing character and trademark images are also included to show the feasibility of the proposed approach.