High dynamic range images contain both the underexposed and the overexposed regions. The enhancement of the underexposed and the overexposed regions is the main concern of this paper. Two new transformation functions are proposed to modify the fuzzy membership values of under and the overexposed regions of an image respectively. For the overexposed regions, a rectangular hyperbolic function is used while for the underexposed regions, an S-function is applied. The shape and range of these functions can be controlled by the parameters involved, which are optimized using the bacterial foraging optimization algorithm so as to obtain the enhanced image. The hue, saturation, and intensity (HSV) color space is employed for the purpose of enhancement, where the hue component is preserved to keep the original color composition intact. This approach is applicable to a degraded image of mixed type. On comparison, the proposed transforms yield better results than the existing transformation functions 17 for both the underexposed and the overexposed regions.