TP2: Simplify the compacter method in the image class.