class_docstr: Constructs a Nougat image processor.
  
  Args:
      do_crop_margin (`bool`, *optional*, defaults to `True`):
          Whether to crop the image margins.
      do_resize (`bool`, *optional*, defaults to `True`):
          Whether to resize the image's (height, width) dimensions to the specified `size`. Can be overridden by
          `do_resize` in the `preprocess` method.
      size (`Dict[str, int]` *optional*, defaults to `{"height": 896, "width": 672}`):
          Size of the image after resizing. Can be overridden 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 `resample` in the `preprocess` method.
      do_thumbnail (`bool`, *optional*, defaults to `True`):
          Whether to resize the image using thumbnail method.
      do_align_long_axis (`bool`, *optional*, defaults to `False`):
          Whether to align the long axis of the image with the long axis of `size` by rotating by 90 degrees.
      do_pad (`bool`, *optional*, defaults to `True`):
          Whether to pad the images to the largest image size in the batch.
      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`):
          Scale factor to use if rescaling the image. Can be overridden by the `rescale_factor` parameter in the
          `preprocess` method.
      do_normalize (`bool`, *optional*, defaults to `True`):
          Whether to normalize the image. Can be overridden by `do_normalize` in the `preprocess` method.
      image_mean (`float` or `List[float]`, *optional*, defaults to `IMAGENET_DEFAULT_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_DEFAULT_STD`):
          Image standard deviation.
class_docstr_tok: ["Constructs","a","Nougat","image","processor",".","Args",":","do_crop_margin","(","`","bool","`",",","*","optional","*",",","defaults","to","`","True","`",")",":","Whether","to","crop","the","image","margins",".","do_resize","(","`","bool","`",",","*","optional","*",",","defaults","to","`","True","`",")",":","Whether","to","resize","the","image","'s","(","height",",","width",")","dimensions","to","the","specified","`","size","`",".","Can","be","overridden","by","`","do_resize","`","in","the","`","preprocess","`","method",".","size","(","`","Dict","[","str",",","int","]","`","*","optional","*",",","defaults","to","`","{","``","height","''",":","896",",","``","width","''",":","672","}","`",")",":","Size","of","the","image","after","resizing",".","Can","be","overridden","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","`","resample","`","in","the","`","preprocess","`","method",".","do_thumbnail","(","`","bool","`",",","*","optional","*",",","defaults","to","`","True","`",")",":","Whether","to","resize","the","image","using","thumbnail","method",".","do_align_long_axis","(","`","bool","`",",","*","optional","*",",","defaults","to","`","False","`",")",":","Whether","to","align","the","long","axis","of","the","image","with","the","long","axis","of","`","size","`","by","rotating","by","90","degrees",".","do_pad","(","`","bool","`",",","*","optional","*",",","defaults","to","`","True","`",")",":","Whether","to","pad","the","images","to","the","largest","image","size","in","the","batch",".","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","`",")",":","Scale","factor","to","use","if","rescaling","the","image",".","Can","be","overridden","by","the","`","rescale_factor","`","parameter","in","the","`","preprocess","`","method",".","do_normalize","(","`","bool","`",",","*","optional","*",",","defaults","to","`","True","`",")",":","Whether","to","normalize","the","image",".","Can","be","overridden","by","`","do_normalize","`","in","the","`","preprocess","`","method",".","image_mean","(","`","float","`","or","`","List","[","float","]","`",",","*","optional","*",",","defaults","to","`","IMAGENET_DEFAULT_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_DEFAULT_STD","`",")",":","Image","standard","deviation","."]
docstr: Pad the image to the specified size at the top, bottom, left and right.
  
  Args:
      image (`np.ndarray`):
          The image to be padded.
      size (`Dict[str, int]`):
          The size `{"height": h, "width": w}` to pad the image to.
      data_format (`str` or `ChannelDimension`, *optional*):
          The data format of the output image. If unset, the same format as the input image is used.
      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","the","image","to","the","specified","size","at","the","top",",","bottom",",","left","and","right",".","Args",":","image","(","`","np.ndarray","`",")",":","The","image","to","be","padded",".","size","(","`","Dict","[","str",",","int","]","`",")",":","The","size","`","{","``","height","''",":","h",",","``","width","''",":","w","}","`","to","pad","the","image","to",".","data_format","(","`","str","`","or","`","ChannelDimension","`",",","*","optional","*",")",":","The","data","format","of","the","output","image",".","If","unset",",","the","same","format","as","the","input","image","is","used",".","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,
      size: Dict[str, int],
      data_format: Optional[Union[str, ChannelDimension]] = None,
      input_data_format: Optional[Union[str, ChannelDimension]] = None,
  ) -> np.ndarray:
      """
      Pad the image to the specified size at the top, bottom, left and right.
  
      Args:
          image (`np.ndarray`):
              The image to be padded.
          size (`Dict[str, int]`):
              The size `{"height": h, "width": w}` to pad the image to.
          data_format (`str` or `ChannelDimension`, *optional*):
              The data format of the output image. If unset, the same format as the input image is used.
          input_data_format (`ChannelDimension` or `str`, *optional*):
              The channel dimension format of the input image. If not provided, it will be inferred.
      """
      output_height, output_width = size["height"], size["width"]
      input_height, input_width = get_image_size(
          image, channel_dim=input_data_format
      )
  
      delta_width = output_width - input_width
      delta_height = output_height - input_height
  
      pad_top = delta_height // 2
      pad_left = delta_width // 2
  
      pad_bottom = delta_height - pad_top
      pad_right = delta_width - pad_left
  
      padding = ((pad_top, pad_bottom), (pad_left, pad_right))
      return pad(
          image,
          padding,
          data_format=data_format,
          input_data_format=input_data_format,
      )
  
file_path: transformers/src/transformers/models/nougat/image_processing_nougat.py
imports: from typing import Dict, List, Optional, Union
  import numpy
  from ...image_processing_utils import BaseImageProcessor, BatchFeature, get_size_dict
  from ...image_transforms import get_resize_output_image_size, pad, resize, to_channel_dimension_format, to_pil_image
  from ...image_utils import IMAGENET_DEFAULT_MEAN, IMAGENET_DEFAULT_STD, ChannelDimension, ImageInput, PILImageResampling, get_image_size, infer_channel_dimension_format, is_scaled_image, make_list_of_images, to_numpy_array, valid_images
  from ...utils import TensorType, logging
  from ...utils.import_utils import is_cv2_available, is_vision_available
label_desc: Use image node_id 6 for calling the NougatImageProcessor obj's underlying member method code with example usage: obj.pad_image(image, size, data_format, input_data_format) and returns: pad