class_docstr: Constructs a Donut feature extractor.
  
  This feature extractor inherits from [`FeatureExtractionMixin`] which contains most of the main methods. Users
  should refer to this superclass for more information regarding those methods.
  
  Args:
      do_resize (`bool`, *optional*, defaults to `True`):
          Whether to resize the shorter edge of the input to the minimum value of a certain `size`.
      size (`Tuple(int)`, *optional*, defaults to [1920, 2560]):
          Resize the shorter edge of the input to the minimum value of the given size. Should be a tuple of (width,
          height). Only has an effect if `do_resize` is set to `True`.
      resample (`int`, *optional*, defaults to `PIL.Image.Resampling.BILINEAR`):
          An optional resampling filter. This can be one of `PIL.Image.Resampling.NEAREST`,
          `PIL.Image.Resampling.BOX`, `PIL.Image.Resampling.BILINEAR`, `PIL.Image.Resampling.HAMMING`,
          `PIL.Image.Resampling.BICUBIC` or `PIL.Image.Resampling.LANCZOS`. Only has an effect if `do_resize` is set
          to `True`.
      do_thumbnail (`bool`, *optional*, defaults to `True`):
          Whether to thumbnail the input to the given `size`.
      do_align_long_axis (`bool`, *optional*, defaults to `False`):
          Whether to rotate the input if the height is greater than width.
      do_pad (`bool`, *optional*, defaults to `True`):
          Whether or not to pad the input to `size`.
      do_normalize (`bool`, *optional*, defaults to `True`):
          Whether or not to normalize the input with mean and standard deviation.
      image_mean (`List[int]`, defaults to `[0.5, 0.5, 0.5]`):
          The sequence of means for each channel, to be used when normalizing images.
      image_std (`List[int]`, defaults to `[0.5, 0.5, 0.5]`):
          The sequence of standard deviations for each channel, to be used when normalizing images.
class_docstr_tok: ["Constructs","a","Donut","feature","extractor",".","This","feature","extractor","inherits","from","[","`","FeatureExtractionMixin","`","]","which","contains","most","of","the","main","methods",".","Users","should","refer","to","this","superclass","for","more","information","regarding","those","methods",".","Args",":","do_resize","(","`","bool","`",",","*","optional","*",",","defaults","to","`","True","`",")",":","Whether","to","resize","the","shorter","edge","of","the","input","to","the","minimum","value","of","a","certain","`","size","`",".","size","(","`","Tuple","(","int",")","`",",","*","optional","*",",","defaults","to","[","1920",",","2560","]",")",":","Resize","the","shorter","edge","of","the","input","to","the","minimum","value","of","the","given","size",".","Should","be","a","tuple","of","(","width",",","height",")",".","Only","has","an","effect","if","`","do_resize","`","is","set","to","`","True","`",".","resample","(","`","int","`",",","*","optional","*",",","defaults","to","`","PIL.Image.Resampling.BILINEAR","`",")",":","An","optional","resampling","filter",".","This","can","be","one","of","`","PIL.Image.Resampling.NEAREST","`",",","`","PIL.Image.Resampling.BOX","`",",","`","PIL.Image.Resampling.BILINEAR","`",",","`","PIL.Image.Resampling.HAMMING","`",",","`","PIL.Image.Resampling.BICUBIC","`","or","`","PIL.Image.Resampling.LANCZOS","`",".","Only","has","an","effect","if","`","do_resize","`","is","set","to","`","True","`",".","do_thumbnail","(","`","bool","`",",","*","optional","*",",","defaults","to","`","True","`",")",":","Whether","to","thumbnail","the","input","to","the","given","`","size","`",".","do_align_long_axis","(","`","bool","`",",","*","optional","*",",","defaults","to","`","False","`",")",":","Whether","to","rotate","the","input","if","the","height","is","greater","than","width",".","do_pad","(","`","bool","`",",","*","optional","*",",","defaults","to","`","True","`",")",":","Whether","or","not","to","pad","the","input","to","`","size","`",".","do_normalize","(","`","bool","`",",","*","optional","*",",","defaults","to","`","True","`",")",":","Whether","or","not","to","normalize","the","input","with","mean","and","standard","deviation",".","image_mean","(","`","List","[","int","]","`",",","defaults","to","`","[","0.5",",","0.5",",","0.5","]","`",")",":","The","sequence","of","means","for","each","channel",",","to","be","used","when","normalizing","images",".","image_std","(","`","List","[","int","]","`",",","defaults","to","`","[","0.5",",","0.5",",","0.5","]","`",")",":","The","sequence","of","standard","deviations","for","each","channel",",","to","be","used","when","normalizing","images","."]
code: def thumbnail(self, image, size):
      if not isinstance(image, Image.Image):
          image = self.to_pil_image(image)
  
      image.thumbnail((size[0], size[1]))
  
      return image
  
file_path: H2O/h2o_flexgen/benchmark/third_party/transformers/src/transformers/models/donut/feature_extraction_donut.py
imports: from typing import Optional, Tuple, Union
  import numpy
  from PIL import Image, ImageOps
  from transformers.image_utils import PILImageResampling
  from ...feature_extraction_utils import BatchFeature, FeatureExtractionMixin
  from ...image_utils import IMAGENET_STANDARD_MEAN, IMAGENET_STANDARD_STD, ImageFeatureExtractionMixin, ImageInput, is_torch_tensor
  from ...utils import TensorType, logging
label_desc: Use image node_id 3 for calling the DonutFeatureExtractor obj's underlying member method code with example usage: obj.thumbnail(image, size) and returns: image