Digital watermarking is gaining a lot of acceptance as a solution to the problem of copyright protection and authentication of multimedia data while working in a networked environment. In this article, an adaptive discrete wavelet transform-based watermarking technique is proposed. The technique exploits perceptual masking properties to embed the watermark in an invisible manner. Genetic programming (GP) is used to make a tradeoff between the two conflicting properties, namely robustness and imperceptibility by choosing an optimum watermarking level for each coefficient of the cover image. Extensive experiments have been carried out, which show that our proposed technique is more resistant against common signal processing operations and geometric attacks than some well-known existing techniques while it preserves the quality of the original image.