We introduce doubly-ranked (DR) monoids in order to study picturecodes. We show that a DR-monoid is free iff it is pictoriallystable. This allows us to associate with a set C of pictures apicture code B(C) which is the basis of the least DR-monoidincluding C.A weak version of the defect theorem for pictures is established.A characterization of picture codes through picture series isalso given.