We consider programmable matter as a collection of simple computational elements (or particles) with limited (constant- size) memory that self-organize to solve system-wide prob- lems of movement, configuration, and coordination. Here, we focus on the compression problem, in which the parti- cle system gathers as tightly together as possible, as in a sphere or its equivalent in the presence of some underlying geometry. More specifically, we seek fully distributed, local, and asynchronous algorithms that lead the system to con- verge to a configuration with small perimeter. We present a Markov chain based algorithm that solves the compression problem under the geometric amoebot model, for particle sys- tems that begin in a connected configuration with no holes. The algorithm takes as input a bias parameter λ, where λ > 1 corresponds to particles favoring inducing more lat- tice triangles within the particle system. We show that for all λ > 5, there is a constant α > 1 such that at stationar- ity with all but exponentially small probability the particles are α-compressed, meaning the perimeter of the system con- figuration is at most α · pmin, where pmin is the minimum possible perimeter of the particle system. We additionally prove that the same algorithm can be used for expansion for small values of λ; in particular, for all 0 < λ < √2; there is a constant fi < 1 such that at stationarity, with all but an ex-ponentially small probability, the perimeter will be at least β · pmax, where pmax is the maximum possible perimeter.