class_docstr: Constructs a Tvp image processor.
  
  Args:
      do_resize (`bool`, *optional*, defaults to `True`):
          Whether to resize the image's (height, width) dimensions to the specified `size`. Can be overridden by the
          `do_resize` parameter in the `preprocess` method.
      size (`Dict[str, int]` *optional*, defaults to `{"longest_edge": 448}`):
          Size of the output image after resizing. The longest edge of the image will be resized to
          `size["longest_edge"]` while maintaining the aspect ratio of the original image. Can be overriden by
          `size` in the `preprocess` method.
      resample (`PILImageResampling`, *optional*, defaults to `Resampling.BILINEAR`):
          Resampling filter to use if resizing the image. Can be overridden by the `resample` parameter in the
          `preprocess` method.
      do_center_crop (`bool`, *optional*, defaults to `True`):
          Whether to center crop the image to the specified `crop_size`. Can be overridden by the `do_center_crop`
          parameter in the `preprocess` method.
      crop_size (`Dict[str, int]`, *optional*, defaults to `{"height": 448, "width": 448}`):
          Size of the image after applying the center crop. Can be overridden by the `crop_size` parameter in the
          `preprocess` method.
      do_rescale (`bool`, *optional*, defaults to `True`):
          Whether to rescale the image by the specified scale `rescale_factor`. Can be overridden by the `do_rescale`
          parameter in the `preprocess` method.
      rescale_factor (`int` or `float`, *optional*, defaults to `1/255`):
          Defines the scale factor to use if rescaling the image. Can be overridden by the `rescale_factor` parameter
          in the `preprocess` method.
      do_pad (`bool`, *optional*, defaults to `True`):
          Whether to pad the image. Can be overridden by the `do_pad` parameter in the `preprocess` method.
      pad_size (`Dict[str, int]`, *optional*, defaults to `{"height": 448, "width": 448}`):
          Size of the image after applying the padding. Can be overridden by the `pad_size` parameter in the
          `preprocess` method.
      constant_values (`Union[float, Iterable[float]]`, *optional*, defaults to 0):
          The fill value to use when padding the image.
      pad_mode (`PaddingMode`, *optional*, defaults to `PaddingMode.CONSTANT`):
          Use what kind of mode in padding.
      do_normalize (`bool`, *optional*, defaults to `True`):
          Whether to normalize the image. Can be overridden by the `do_normalize` parameter in the `preprocess`
          method.
      do_flip_channel_order (`bool`, *optional*, defaults to `True`):
          Whether to flip the color channels from RGB to BGR. Can be overridden by the `do_flip_channel_order`
          parameter in the `preprocess` method.
      image_mean (`float` or `List[float]`, *optional*, defaults to `IMAGENET_STANDARD_MEAN`):
          Mean to use if normalizing the image. This is a float or list of floats the length of the number of
          channels in the image. Can be overridden by the `image_mean` parameter in the `preprocess` method.
      image_std (`float` or `List[float]`, *optional*, defaults to `IMAGENET_STANDARD_STD`):
          Standard deviation to use if normalizing the image. This is a float or list of floats the length of the
          number of channels in the image. Can be overridden by the `image_std` parameter in the `preprocess` method.
class_docstr_tok: ["Constructs","a","Tvp","image","processor",".","Args",":","do_resize","(","`","bool","`",",","*","optional","*",",","defaults","to","`","True","`",")",":","Whether","to","resize","the","image","'s","(","height",",","width",")","dimensions","to","the","specified","`","size","`",".","Can","be","overridden","by","the","`","do_resize","`","parameter","in","the","`","preprocess","`","method",".","size","(","`","Dict","[","str",",","int","]","`","*","optional","*",",","defaults","to","`","{","``","longest_edge","''",":","448","}","`",")",":","Size","of","the","output","image","after","resizing",".","The","longest","edge","of","the","image","will","be","resized","to","`","size","[","``","longest_edge","''","]","`","while","maintaining","the","aspect","ratio","of","the","original","image",".","Can","be","overriden","by","`","size","`","in","the","`","preprocess","`","method",".","resample","(","`","PILImageResampling","`",",","*","optional","*",",","defaults","to","`","Resampling.BILINEAR","`",")",":","Resampling","filter","to","use","if","resizing","the","image",".","Can","be","overridden","by","the","`","resample","`","parameter","in","the","`","preprocess","`","method",".","do_center_crop","(","`","bool","`",",","*","optional","*",",","defaults","to","`","True","`",")",":","Whether","to","center","crop","the","image","to","the","specified","`","crop_size","`",".","Can","be","overridden","by","the","`","do_center_crop","`","parameter","in","the","`","preprocess","`","method",".","crop_size","(","`","Dict","[","str",",","int","]","`",",","*","optional","*",",","defaults","to","`","{","``","height","''",":","448",",","``","width","''",":","448","}","`",")",":","Size","of","the","image","after","applying","the","center","crop",".","Can","be","overridden","by","the","`","crop_size","`","parameter","in","the","`","preprocess","`","method",".","do_rescale","(","`","bool","`",",","*","optional","*",",","defaults","to","`","True","`",")",":","Whether","to","rescale","the","image","by","the","specified","scale","`","rescale_factor","`",".","Can","be","overridden","by","the","`","do_rescale","`","parameter","in","the","`","preprocess","`","method",".","rescale_factor","(","`","int","`","or","`","float","`",",","*","optional","*",",","defaults","to","`","1\/255","`",")",":","Defines","the","scale","factor","to","use","if","rescaling","the","image",".","Can","be","overridden","by","the","`","rescale_factor","`","parameter","in","the","`","preprocess","`","method",".","do_pad","(","`","bool","`",",","*","optional","*",",","defaults","to","`","True","`",")",":","Whether","to","pad","the","image",".","Can","be","overridden","by","the","`","do_pad","`","parameter","in","the","`","preprocess","`","method",".","pad_size","(","`","Dict","[","str",",","int","]","`",",","*","optional","*",",","defaults","to","`","{","``","height","''",":","448",",","``","width","''",":","448","}","`",")",":","Size","of","the","image","after","applying","the","padding",".","Can","be","overridden","by","the","`","pad_size","`","parameter","in","the","`","preprocess","`","method",".","constant_values","(","`","Union","[","float",",","Iterable","[","float","]","]","`",",","*","optional","*",",","defaults","to","0",")",":","The","fill","value","to","use","when","padding","the","image",".","pad_mode","(","`","PaddingMode","`",",","*","optional","*",",","defaults","to","`","PaddingMode.CONSTANT","`",")",":","Use","what","kind","of","mode","in","padding",".","do_normalize","(","`","bool","`",",","*","optional","*",",","defaults","to","`","True","`",")",":","Whether","to","normalize","the","image",".","Can","be","overridden","by","the","`","do_normalize","`","parameter","in","the","`","preprocess","`","method",".","do_flip_channel_order","(","`","bool","`",",","*","optional","*",",","defaults","to","`","True","`",")",":","Whether","to","flip","the","color","channels","from","RGB","to","BGR",".","Can","be","overridden","by","the","`","do_flip_channel_order","`","parameter","in","the","`","preprocess","`","method",".","image_mean","(","`","float","`","or","`","List","[","float","]","`",",","*","optional","*",",","defaults","to","`","IMAGENET_STANDARD_MEAN","`",")",":","Mean","to","use","if","normalizing","the","image",".","This","is","a","float","or","list","of","floats","the","length","of","the","number","of","channels","in","the","image",".","Can","be","overridden","by","the","`","image_mean","`","parameter","in","the","`","preprocess","`","method",".","image_std","(","`","float","`","or","`","List","[","float","]","`",",","*","optional","*",",","defaults","to","`","IMAGENET_STANDARD_STD","`",")",":","Standard","deviation","to","use","if","normalizing","the","image",".","This","is","a","float","or","list","of","floats","the","length","of","the","number","of","channels","in","the","image",".","Can","be","overridden","by","the","`","image_std","`","parameter","in","the","`","preprocess","`","method","."]
docstr: Pad an image with zeros to the given size.
  
  Args:
      image (`np.ndarray`):
          Image to pad.
      pad_size (`Dict[str, int]`)
          Size of the output image with pad.
      constant_values (`Union[float, Iterable[float]]`)
          The fill value to use when padding the image.
      pad_mode (`PaddingMode`)
          The pad mode, default to PaddingMode.CONSTANT
      data_format (`ChannelDimension` or `str`, *optional*)
          The channel dimension format of the image. If not provided, it will be the same as the input image.
      input_data_format (`ChannelDimension` or `str`, *optional*):
          The channel dimension format of the input image. If not provided, it will be inferred.
docstr_tok: ["Pad","an","image","with","zeros","to","the","given","size",".","Args",":","image","(","`","np.ndarray","`",")",":","Image","to","pad",".","pad_size","(","`","Dict","[","str",",","int","]","`",")","Size","of","the","output","image","with","pad",".","constant_values","(","`","Union","[","float",",","Iterable","[","float","]","]","`",")","The","fill","value","to","use","when","padding","the","image",".","pad_mode","(","`","PaddingMode","`",")","The","pad","mode",",","default","to","PaddingMode.CONSTANT","data_format","(","`","ChannelDimension","`","or","`","str","`",",","*","optional","*",")","The","channel","dimension","format","of","the","image",".","If","not","provided",",","it","will","be","the","same","as","the","input","image",".","input_data_format","(","`","ChannelDimension","`","or","`","str","`",",","*","optional","*",")",":","The","channel","dimension","format","of","the","input","image",".","If","not","provided",",","it","will","be","inferred","."]
code: def pad_image(
      self,
      image: np.ndarray,
      pad_size: Dict[str, int] = None,
      constant_values: Union[float, Iterable[float]] = 0,
      pad_mode: PaddingMode = PaddingMode.CONSTANT,
      data_format: Optional[Union[str, ChannelDimension]] = None,
      input_data_format: Optional[Union[str, ChannelDimension]] = None,
      **kwargs,
  ):
      """
      Pad an image with zeros to the given size.
  
      Args:
          image (`np.ndarray`):
              Image to pad.
          pad_size (`Dict[str, int]`)
              Size of the output image with pad.
          constant_values (`Union[float, Iterable[float]]`)
              The fill value to use when padding the image.
          pad_mode (`PaddingMode`)
              The pad mode, default to PaddingMode.CONSTANT
          data_format (`ChannelDimension` or `str`, *optional*)
              The channel dimension format of the image. If not provided, it will be the same as the input image.
          input_data_format (`ChannelDimension` or `str`, *optional*):
              The channel dimension format of the input image. If not provided, it will be inferred.
      """
      height, width = get_image_size(
          image, channel_dim=input_data_format
      )
      max_height = pad_size.get("height", height)
      max_width = pad_size.get("width", width)
  
      pad_right, pad_bottom = max_width - width, max_height - height
      if pad_right < 0 or pad_bottom < 0:
          raise ValueError(
              "The padding size must be greater than image size"
          )
  
      padding = ((0, pad_bottom), (0, pad_right))
      padded_image = pad(
          image,
          padding,
          mode=pad_mode,
          constant_values=constant_values,
          data_format=data_format,
          input_data_format=input_data_format,
      )
  
      return padded_image
  
file_path: transformers/src/transformers/models/tvp/image_processing_tvp.py
imports: from typing import Dict, Iterable, List, Optional, Tuple, Union
  import numpy
  from ...image_processing_utils import BaseImageProcessor, BatchFeature, get_size_dict
  from ...image_transforms import PaddingMode, flip_channel_order, pad, resize, to_channel_dimension_format
  from ...image_utils import IMAGENET_STANDARD_MEAN, IMAGENET_STANDARD_STD, ChannelDimension, ImageInput, PILImageResampling, get_image_size, is_valid_image, to_numpy_array, valid_images
  from ...utils import TensorType, is_vision_available, logging
label_desc: Use image node_id 3 for calling the TvpImageProcessor obj's underlying member method code with example usage: obj.pad_image(image, pad_size, constant_values, pad_mode, data_format, input_data_format) and returns: padded_image