def _transform_value_range(
        self, images, original_range, target_range, dtype="float32"
    ):
        """Convert input values from `original_range` to `target_range`.

        This function is intended to be used in preprocessing layers that
        rely upon color values. This allows us to assume internally that
        the input tensor is always in the range `(0, 255)`.

        Args:
            images: the set of images to transform to the target range.
            original_range: the value range to transform from.
            target_range: the value range to transform to.
            dtype: the dtype to compute the conversion with,
                defaults to "float32".

        Returns:
            a new Tensor with values in the target range.

        Example:

        ```python
        original_range = [0, 1]
        target_range = [0, 255]
        images = layer.preprocessing.transform_value_range(
            images,
            original_range,
            target_range
        )
        images = ops.minimum(images + 10, 255)
        images = layer.preprocessing.transform_value_range(
            images,
            target_range,
            original_range
        )
        ```
        """
        if (
            original_range[0] == target_range[0]
            and original_range[1] == target_range[1]
        ):
            return images

        images = self.backend.cast(images, dtype=dtype)
        original_min_value, original_max_value = self._unwrap_value_range(
            original_range, dtype=dtype
        )
        target_min_value, target_max_value = self._unwrap_value_range(
            target_range, dtype=dtype
        )

        # images in the [0, 1] scale
        images = (images - original_min_value) / (
            original_max_value - original_min_value
        )

        scale_factor = target_max_value - target_min_value
        return (images * scale_factor) + target_min_value
Convert input values from `original_range` to `target_range`.

        This function is intended to be used in preprocessing layers that
        rely upon color values. This allows us to assume internally that
        the input tensor is always in the range `(0, 255)`.

        Args:
            images: the set of images to transform to the target range.
            original_range: the value range to transform from.
            target_range: the value range to transform to.
            dtype: the dtype to compute the conversion with,
                defaults to "float32".

        Returns:
            a new Tensor with values in the target range.

        Example:

        ```python
        original_range = [0, 1]
        target_range = [0, 255]
        images = layer.preprocessing.transform_value_range(
            images,
            original_range,
            target_range
        )
        images = ops.minimum(images + 10, 255)
        images = layer.preprocessing.transform_value_range(
            images,
            target_range,
            original_range
        )
        ```
        
keras/src/layers/preprocessing/image_preprocessing/base_image_preprocessing_layer.py