This paper considers modeling 2D images by a Gibbs random fieldwhose ground states are figures invariant under the opening by a givenstructuring element. Numerical simulation by a Monte Carlo Markov chainis achieved, thanks to a modification of the Metropolis algorithm. Linkswith the “pattern spectrum” morphological toolare exhibited. The model can be applied to the synthesis oftextures, and when combined with a Bayes classifier, it can be usefulfor classifying natural textures.