| 64 | |
| 65 | @register_to_config |
| 66 | def __init__( |
| 67 | self, |
| 68 | do_resize: bool = True, |
| 69 | vae_scale_factor: int = 8, |
| 70 | resample: str = "lanczos", |
| 71 | do_normalize: bool = True, |
| 72 | do_binarize: bool = False, |
| 73 | do_convert_rgb: bool = False, |
| 74 | do_convert_grayscale: bool = False, |
| 75 | ): |
| 76 | super().__init__() |
| 77 | if do_convert_rgb and do_convert_grayscale: |
| 78 | raise ValueError( |
| 79 | "`do_convert_rgb` and `do_convert_grayscale` can not both be set to `True`," |
| 80 | " if you intended to convert the image into RGB format, please set `do_convert_grayscale = False`.", |
| 81 | " if you intended to convert the image into grayscale format, please set `do_convert_rgb = False`", |
| 82 | ) |
| 83 | self.config.do_convert_rgb = False |
| 84 | |
| 85 | @staticmethod |
| 86 | def numpy_to_pil(images: np.ndarray) -> List[PIL.Image.Image]: |