Recently, piracy and copyright violations of digital content have become major concerns as computer science has advanced. In order to prevent unauthorized usage of content, digital watermarking is usually employed. This work proposes a new approach to digital image watermarking that makes use of the discrete cosine transform (DCT), discrete wavelet transform (DWT), dipper-throated optimization (DTO), and stochastic fractal search (SFS) algorithms. The proposed approach involves computing the discrete wavelet transform (DWT) on the cover image to extract its sub-components, followed by the performance of a discrete cosine transform (DCT) to convert these sub-components into the frequency domain. Finding the best scale factor for watermarking is a significant challenge in most watermarking methods. The authors used an advanced optimization algorithm, which is referred to as DTOSFS, to determine the best two parameters—namely, the scaling factor and embedding coefficient—to be used while inserting a watermark into a cover image. Using the optimal values of these parameters, a watermark image can be inserted into a cover image more efficiently. The suggested approach is evaluated in comparison with the current gold standard. The normalized cross-correlation (NCC), peak-signal-to-noise ratio (PSNR), and image fidelity (IF) are used to measure the success of the proposed approach. In addition, a statistical analysis is performed to evaluate the significance and superiority of the proposed approach. The experimental results confirm the effectiveness of the proposed approach in improving upon standard watermarking methods based on the DWT and DCT. Moreover, a set of attacks is considered to study the robustness of the proposed approach, and the results confirm the expected outcomes. It is shown by the achieved results that the proposed approach can be utilized for practical digital image watermarking, and that it significantly outperforms other digital image watermarking methods.