There is a method and a corresponding system for optimizing X-ray imaging during a mammographic examination. In order to provide an optimization of X-ray imaging in a first step (SOI) a breast (7) is compressed between a support plate (5) and a compression plate (3). In a next step (S03), a force-height curve (13) is acquired during compression. Then, in a further step (S05) an elasticity value of the breast (7) is determined radiation-free based on the force-height curve (13). In a further step (S07), a parameter of an X-ray imaging system is optimized based on the determined glandularity (g). As the glandularity (g) of a breast may influence the attenuation of X-rays, the personalized setting of the parameters of the X-ray imaging system may greatly enhance the image quality.