Contrast enhancement is an important pre-processing task in any Image Analysis (IA) system. In this paper, we formulate the image contrast enhancement problem as an optimization problem where the goal is to optimize the pixel intensity values of an input image to obtain a contrast enhanced version of the same. This optimization task is executed by suitably customizing a nature-inspired optimization algorithm called Selfish Herd Optimizer (SHO). The optimization problem is solved using two different solution representations: pixel wise optimization (SHO(direct)) and transformation function based optimization (SHO(transformation)). Moreover, an ablation study is performed to select the most appropriate parameters which can be used in tness measure for this optimization problem. On experimenting over the popular Kodak image dataset, it has been observed that the proposed methods outperform many existing methods published recently. Further comparisons indicate that the direct approach performs better than its transformation counterpart. This paper further investigates the robustness of SHO(direct) approach by applying it to enhance the degraded document images of H-DIBCO 2018.