First departure algorithms and image decompositions into peaks and wells