A method for automatic contour filter positioning in an X-ray apparatus comprising at least one movable contour filter actuated by a motor based positioning subsystem. The steps of the method:a) identification of exposure of subareas, comprising- segmenting the image (20) into smaller subareas- computing local EPT for each subarea as average brightness of the pixels included in the subarea,- computing overall average of the local EPTs,- providing an EPT-difference map (23) by subtracting the overall average of the local EPTs from each local EPT,b) preparation for filter positioning, comprising- adding a single pixel wide border (24, 25) to the EPT-difference map (23) by assigning one border pixel to each row and column,- computing the pixel values of the border as a weighted average of all the pixels in the corresponding row or column, the weighting factor is proportional with the distance between the pixel and the corresponding border pixel,c) filter position definition, comprising- identifying two groups of negative value border pixels starting from the lowest values, on two different sides of the image, where the ends of the filter position will be located.