How does the process of contempt proceedings protect the integrity of the judiciary?

I want to understand why contempt proceedings are important when someone makes remarks against the Chief Justice of India. How do such actions maintain trust in the judicial system?