MCPcopy Create free account
hub / github.com/AlayaLab/Hive / resize

Method resize

models/flowsep/diffusers/image_processor.py:104–111  ·  view source on GitHub ↗

Resize a PIL image. Both height and width will be downscaled to the next integer multiple of `vae_scale_factor`

(self, images: PIL.Image.Image)

Source from the content-addressed store, hash-verified

102 return (images / 2 + 0.5).clamp(0, 1)
103
104 def resize(self, images: PIL.Image.Image) -> PIL.Image.Image:
105 """
106 Resize a PIL image. Both height and width will be downscaled to the next integer multiple of `vae_scale_factor`
107 """
108 w, h = images.size
109 w, h = (x - x % self.config.vae_scale_factor for x in (w, h)) # resize to integer multiple of vae_scale_factor
110 images = images.resize((w, h), resample=PIL_INTERPOLATION[self.config.resample])
111 return images
112
113 def preprocess(
114 self,

Callers 15

preprocessMethod · 0.95
preprocess_imageFunction · 0.80
preprocessFunction · 0.80
preprocessFunction · 0.80
_preprocess_imageFunction · 0.80
_preprocess_maskFunction · 0.80
preprocessFunction · 0.80
prepare_control_imageMethod · 0.80
prepare_control_imageMethod · 0.80
prepare_imageMethod · 0.80
preprocessFunction · 0.80

Calls

no outgoing calls

Tested by 1

preprocess_imageFunction · 0.64