A method for rate-control adaptation in an image encoder, the method comprising: accessing by the encoder an input image to be compressed; determining by the encoder if an electro-optical transfer function, EOTF, -coding for the input image is gamma-based or perceptual quantization, PQ, -based; determining by the encoder at least one mid-tones threshold for the input image, and for an image region in the input image, using the encoder: computing a metric of luminance for pixels in the image region, wherein the metric of luminance is one of a mean, a median and a maximum luminance value of the pixels in the image region, determining if the image region is a highlight luminance region or a dark luminance region based on the at least one mid-tones threshold and the computed metric of luminance, and adjusting a base quantization parameter, QP Base, to generate a new quantization parameter, QPnew, wherein: if it is determined that the EOTF for the input image is PQ-based, the new quantization parameter is smaller than the base quantization parameter if it is determined that the image region is a highlight luminance region, and the new quantization parameter is larger than the base quantization parameter if it is determined that image region is a dark luminance region; and if it is determined that the EOTF for the input image is gamma-based, the new quantization parameter is larger than the base quantization parameter if it is determined that the image region is a highlight luminance region, and the new quantization parameter is smaller than the base quantization parameter if it is determined that the image region is a dark luminance region. accessing by the encoder an input image to be compressed; determining by the encoder if an electro-optical transfer function, EOTF, -coding for the input image is gamma-based or perceptual quantization, PQ, -based; determining by the encoder at least one mid-tones threshold for the input image, and for an image region in the input image, using the encoder: computing a metric of luminance for pixels in the image region, wherein the metric of luminance is one of a mean, a median and a maximum luminance value of the pixels in the image region, determining if the image region is a highlight luminance region or a dark luminance region based on the at least one mid-tones threshold and the computed metric of luminance, and adjusting a base quantization parameter, QP Base, to generate a new quantization parameter, QPnew, wherein: if it is determined that the EOTF for the input image is PQ-based, the new quantization parameter is smaller than the base quantization parameter if it is determined that the image region is a highlight luminance region, and the new quantization parameter is larger than the base quantization parameter if it is determined that image region is a dark luminance region; and if it is determined that the EOTF for the input image is gamma-based, the new quantization parameter is larger than the base quantization parameter if it is determined that the image region is a highlight luminance region, and the new quantization parameter is smaller than the base quantization parameter if it is determined that the image region is a dark luminance region. computing a metric of luminance for pixels in the image region, wherein the metric of luminance is one of a mean, a median and a maximum luminance value of the pixels in the image region, determining if the image region is a highlight luminance region or a dark luminance region based on the at least one mid-tones threshold and the computed metric of luminance, and adjusting a base quantization parameter, QP Base, to generate a new quantization parameter, QPnew, wherein: if it is determined that the EOTF for the input image is PQ-based, the new quantization parameter is smaller than the base quantization parameter if it is determined that the image region is a highlight luminance region, and the new quantization parameter is larger than the base quantization parameter if it is determined that image region is a dark luminance region; and if it is determined that the EOTF for the input image is gamma-based, the new quantization parameter is larger than the base quantization parameter if it is determined that the image region is a highlight luminance region, and the new quantization parameter is smaller than the base quantization parameter if it is determined that the image region is a dark luminance region. if it is determined that the EOTF for the input image is PQ-based, the new quantization parameter is smaller than the base quantization parameter if it is determined that the image region is a highlight luminance region, and the new quantization parameter is larger than the base quantization parameter if it is determined that image region is a dark luminance region; and if it is determined that the EOTF for the input image is gamma-based, the new quantization parameter is larger than the base quantization parameter if it is determined that the image region is a highlight luminance region, and the new quantization parameter is smaller than the base quantization parameter if it is determined that the image region is a dark luminance region.