The present invention relates to a method for calibrating elements in a spatial light modulator (SLM) as a function of an applied element control signal. A plurality of elements are calibrated simultaneously. A beam of electromagnetic radiation is projected onto at least a part of the SLM. An image of said part of said SLM is formed on a device for measuring intensity of electromagnetic radiation. Element calibrating data is generated by using the intensity data as a function of the applied element control signal by either driving a sub-matrix comprising at least two elements out of said part of the SLM to a sequence of applied element control signals or by seeking out the control signal for each element which give the same predetermined intensity value on the device for measuring the intensity of electromagnetic radiation and stepping through N different predetermined intensity values. The invention also relates to an apparatus for patterning a workpiece having such a calibration method. Other aspects of the present invention are reflected in the detailed description.