We present a new spatially-varying dynamic range compression algorithm for high dynamic range (HDR) images based on bound-constrained optimization using soft constraints. Rather than explicitly attenuating gradients as in previous work, we minimize an objective function to instead compute a globally optimal manipulation of input pixel differences. Our framework provides simple yet effective preservation of visually important image properties, such as order statistics and global consistency, that requires little to no parameter tuning. Our results are free of haloing, washout, and other artifacts, while retaining detail across the image's full range. The speed of our algorithm and flexibility of the constraint framework allows our method to be easily extended to video.