class_docstr: Constructs a LayoutLMv2 image processor.
  
  Args:
      do_resize (`bool`, *optional*, defaults to `True`):
          Whether to resize the image's (height, width) dimensions to `(size["height"], size["width"])`. Can be
          overridden by `do_resize` in `preprocess`.
      size (`Dict[str, int]` *optional*, defaults to `{"height": 224, "width": 224}`):
          Size of the image after resizing. Can be overridden by `size` in `preprocess`.
      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.
      apply_ocr (`bool`, *optional*, defaults to `True`):
          Whether to apply the Tesseract OCR engine to get words + normalized bounding boxes. Can be overridden by
          `apply_ocr` in `preprocess`.
      ocr_lang (`str`, *optional*):
          The language, specified by its ISO code, to be used by the Tesseract OCR engine. By default, English is
          used. Can be overridden by `ocr_lang` in `preprocess`.
      tesseract_config (`str`, *optional*, defaults to `""`):
          Any additional custom configuration flags that are forwarded to the `config` parameter when calling
          Tesseract. For example: '--psm 6'. Can be overridden by `tesseract_config` in `preprocess`.
class_docstr_tok: ["Constructs","a","LayoutLMv2","image","processor",".","Args",":","do_resize","(","`","bool","`",",","*","optional","*",",","defaults","to","`","True","`",")",":","Whether","to","resize","the","image","'s","(","height",",","width",")","dimensions","to","`","(","size","[","``","height","''","]",",","size","[","``","width","''","]",")","`",".","Can","be","overridden","by","`","do_resize","`","in","`","preprocess","`",".","size","(","`","Dict","[","str",",","int","]","`","*","optional","*",",","defaults","to","`","{","``","height","''",":","224",",","``","width","''",":","224","}","`",")",":","Size","of","the","image","after","resizing",".","Can","be","overridden","by","`","size","`","in","`","preprocess","`",".","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",".","apply_ocr","(","`","bool","`",",","*","optional","*",",","defaults","to","`","True","`",")",":","Whether","to","apply","the","Tesseract","OCR","engine","to","get","words","+","normalized","bounding","boxes",".","Can","be","overridden","by","`","apply_ocr","`","in","`","preprocess","`",".","ocr_lang","(","`","str","`",",","*","optional","*",")",":","The","language",",","specified","by","its","ISO","code",",","to","be","used","by","the","Tesseract","OCR","engine",".","By","default",",","English","is","used",".","Can","be","overridden","by","`","ocr_lang","`","in","`","preprocess","`",".","tesseract_config","(","`","str","`",",","*","optional","*",",","defaults","to","`","``","''","`",")",":","Any","additional","custom","configuration","flags","that","are","forwarded","to","the","`","config","`","parameter","when","calling","Tesseract",".","For","example",":","'","--","psm","6","'",".","Can","be","overridden","by","`","tesseract_config","`","in","`","preprocess","`","."]
docstr: Resize an image to `(size["height"], size["width"])`.
  
  Args:
      image (`np.ndarray`):
          Image to resize.
      size (`Dict[str, int]`):
          Dictionary in the format `{"height": int, "width": int}` specifying the size of the output image.
      resample (`PILImageResampling`, *optional*, defaults to `PILImageResampling.BILINEAR`):
          `PILImageResampling` filter to use when resizing the image e.g. `PILImageResampling.BILINEAR`.
      data_format (`ChannelDimension` or `str`, *optional*):
          The channel dimension format for the output image. If unset, the channel dimension format of the input
          image is used. Can be one of:
          - `"channels_first"` or `ChannelDimension.FIRST`: image in (num_channels, height, width) format.
          - `"channels_last"` or `ChannelDimension.LAST`: image in (height, width, num_channels) format.
          - `"none"` or `ChannelDimension.NONE`: image in (height, width) format.
      input_data_format (`ChannelDimension` or `str`, *optional*):
          The channel dimension format for the input image. If unset, the channel dimension format is inferred
          from the input image. Can be one of:
          - `"channels_first"` or `ChannelDimension.FIRST`: image in (num_channels, height, width) format.
          - `"channels_last"` or `ChannelDimension.LAST`: image in (height, width, num_channels) format.
          - `"none"` or `ChannelDimension.NONE`: image in (height, width) format.
  
  Returns:
      `np.ndarray`: The resized image.
docstr_tok: ["Resize","an","image","to","`","(","size","[","``","height","''","]",",","size","[","``","width","''","]",")","`",".","Args",":","image","(","`","np.ndarray","`",")",":","Image","to","resize",".","size","(","`","Dict","[","str",",","int","]","`",")",":","Dictionary","in","the","format","`","{","``","height","''",":","int",",","``","width","''",":","int","}","`","specifying","the","size","of","the","output","image",".","resample","(","`","PILImageResampling","`",",","*","optional","*",",","defaults","to","`","PILImageResampling.BILINEAR","`",")",":","`","PILImageResampling","`","filter","to","use","when","resizing","the","image","e.g",".","`","PILImageResampling.BILINEAR","`",".","data_format","(","`","ChannelDimension","`","or","`","str","`",",","*","optional","*",")",":","The","channel","dimension","format","for","the","output","image",".","If","unset",",","the","channel","dimension","format","of","the","input","image","is","used",".","Can","be","one","of",":","-","`","``","channels_first","''","`","or","`","ChannelDimension.FIRST","`",":","image","in","(","num_channels",",","height",",","width",")","format",".","-","`","``","channels_last","''","`","or","`","ChannelDimension.LAST","`",":","image","in","(","height",",","width",",","num_channels",")","format",".","-","`","``","none","''","`","or","`","ChannelDimension.NONE","`",":","image","in","(","height",",","width",")","format",".","input_data_format","(","`","ChannelDimension","`","or","`","str","`",",","*","optional","*",")",":","The","channel","dimension","format","for","the","input","image",".","If","unset",",","the","channel","dimension","format","is","inferred","from","the","input","image",".","Can","be","one","of",":","-","`","``","channels_first","''","`","or","`","ChannelDimension.FIRST","`",":","image","in","(","num_channels",",","height",",","width",")","format",".","-","`","``","channels_last","''","`","or","`","ChannelDimension.LAST","`",":","image","in","(","height",",","width",",","num_channels",")","format",".","-","`","``","none","''","`","or","`","ChannelDimension.NONE","`",":","image","in","(","height",",","width",")","format",".","Returns",":","`","np.ndarray","`",":","The","resized","image","."]
code: def resize(
      self,
      image: np.ndarray,
      size: Dict[str, int],
      resample: PILImageResampling = PILImageResampling.BILINEAR,
      data_format: Optional[Union[str, ChannelDimension]] = None,
      input_data_format: Optional[Union[str, ChannelDimension]] = None,
      **kwargs,
  ) -> np.ndarray:
      """
      Resize an image to `(size["height"], size["width"])`.
  
      Args:
          image (`np.ndarray`):
              Image to resize.
          size (`Dict[str, int]`):
              Dictionary in the format `{"height": int, "width": int}` specifying the size of the output image.
          resample (`PILImageResampling`, *optional*, defaults to `PILImageResampling.BILINEAR`):
              `PILImageResampling` filter to use when resizing the image e.g. `PILImageResampling.BILINEAR`.
          data_format (`ChannelDimension` or `str`, *optional*):
              The channel dimension format for the output image. If unset, the channel dimension format of the input
              image is used. Can be one of:
              - `"channels_first"` or `ChannelDimension.FIRST`: image in (num_channels, height, width) format.
              - `"channels_last"` or `ChannelDimension.LAST`: image in (height, width, num_channels) format.
              - `"none"` or `ChannelDimension.NONE`: image in (height, width) format.
          input_data_format (`ChannelDimension` or `str`, *optional*):
              The channel dimension format for the input image. If unset, the channel dimension format is inferred
              from the input image. Can be one of:
              - `"channels_first"` or `ChannelDimension.FIRST`: image in (num_channels, height, width) format.
              - `"channels_last"` or `ChannelDimension.LAST`: image in (height, width, num_channels) format.
              - `"none"` or `ChannelDimension.NONE`: image in (height, width) format.
  
      Returns:
          `np.ndarray`: The resized image.
      """
      size = get_size_dict(size)
      if "height" not in size or "width" not in size:
          raise ValueError(
              f"The `size` dictionary must contain the keys `height` and `width`. Got {size.keys()}"
          )
      output_size = (size["height"], size["width"])
      return resize(
          image,
          size=output_size,
          resample=resample,
          data_format=data_format,
          input_data_format=input_data_format,
          **kwargs,
      )
  
file_path: transformers/src/transformers/models/layoutlmv2/image_processing_layoutlmv2.py
imports: from typing import Dict, Optional, Union
  import numpy
  from ...image_processing_utils import BaseImageProcessor, BatchFeature, get_size_dict
  from ...image_transforms import flip_channel_order, resize, to_channel_dimension_format, to_pil_image
  from ...image_utils import ChannelDimension, ImageInput, PILImageResampling, infer_channel_dimension_format, make_list_of_images, to_numpy_array, valid_images
  from ...utils import TensorType, is_pytesseract_available, is_vision_available, logging, requires_backends
label_desc: Use image node_id 2 for calling the LayoutLMv2ImageProcessor obj's underlying member method code with example usage: obj.resize(image, size, resample, data_format, input_data_format) and returns: resize