Learned image compression is making good progress in recent years. Peaksignal-to-noise ratio (PSNR) and multi-scale structural similarity (MS-SSIM)are the two most popular evaluation metrics. As different metrics only reflectcertain aspects of human perception, works in this field normally optimize twomodels using PSNR and MS-SSIM as loss function separately, which is suboptimaland makes it difficult to select the model with best visual quality or overallperformance. Towards solving this problem, we propose to Harmonize optimizationmetrics in Learned Image Compression (HLIC) using online loss functionadaptation by reinforcement learning. By doing so, we are able to leverage theadvantages of both PSNR and MS-SSIM, achieving better visual quality and higherVMAF score. To our knowledge, our work is the first to explore automatic lossfunction adaptation for harmonizing optimization metrics in low level visiontasks like learned image compression.