An image forming apparatus which forms an image based on image data by using an image processing section, having an image carrier, an exposure unit which scans and exposes the image carrier, and a developing unit which visualizes, on a printing medium, an electrostatic latent image formed on the image carrier by scanning exposure of the exposure unit, comprising: image data storage means for storing image data; storage means (413C, 413M, 413Y, 413K) for storing error amount information representing an error amount in a sub-scanning direction of a scanning line of exposure light in an exposure scanning direction on the image carrier; and first modification means (408C, 408M, 408Y, 408K) for modifying the image data by shifting the image data in the sub-scanning direction on the basis of the error amount information stored in said storage means so as to offset an error amount in the sub-scanning direction of the scanning line, characterized by: second modification means (416C, 416M, 416Y, 416K) for modifying a masked area for restricting an output position of an image visualized on the printing medium on the basis of a modification amount in the sub-scanning direction of the image data modified by said first modification means (408C, 408M, 408Y, 408K), wherein an effective image area inside the masked area is smaller than the printing medium and the output position is restricted by invalidating the image data modified by said first modification means (408C, 408M, 408Y, 408K) in the modified masked area. image data storage means for storing image data; storage means (413C, 413M, 413Y, 413K) for storing error amount information representing an error amount in a sub-scanning direction of a scanning line of exposure light in an exposure scanning direction on the image carrier; and first modification means (408C, 408M, 408Y, 408K) for modifying the image data by shifting the image data in the sub-scanning direction on the basis of the error amount information stored in said storage means so as to offset an error amount in the sub-scanning direction of the scanning line, characterized by: second modification means (416C, 416M, 416Y, 416K) for modifying a masked area for restricting an output position of an image visualized on the printing medium on the basis of a modification amount in the sub-scanning direction of the image data modified by said first modification means (408C, 408M, 408Y, 408K), wherein an effective image area inside the masked area is smaller than the printing medium and the output position is restricted by invalidating the image data modified by said first modification means (408C, 408M, 408Y, 408K) in the modified masked area. second modification means (416C, 416M, 416Y, 416K) for modifying a masked area for restricting an output position of an image visualized on the printing medium on the basis of a modification amount in the sub-scanning direction of the image data modified by said first modification means (408C, 408M, 408Y, 408K), wherein an effective image area inside the masked area is smaller than the printing medium and the output position is restricted by invalidating the image data modified by said first modification means (408C, 408M, 408Y, 408K) in the modified masked area.