File: Broken/Externals/Upscaler/__init__.py
¶
Broken.Externals.Upscaler ¶
UpscalerBase ¶
Bases: ExternalModelsBase
, ABC
Source code in Broken/Externals/Upscaler/__init__.py
19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 |
|
width ¶
width: Annotated[
int,
Option(
--width,
-w,
min=0,
help="[bold red](🔴 Basic )[/] Upscaled image width, automatic on height aspect ratio if 0, forced if both are set",
),
] = Field(0, gt=-1)
height ¶
height: Annotated[
int,
Option(
--height,
-h,
min=0,
help="[bold red](🔴 Basic )[/] Upscaled image height, automatic on width aspect ratio if 0, forced if both are set",
),
] = Field(0, gt=-1)
scale ¶
scale: Annotated[
int,
Option(
--scale,
-s,
min=1,
help="[bold red](🔴 Basic )[/] Single pass upscale factor. For precision, over-scale and force width and/or height",
),
] = Field(2, gt=0)
passes ¶
passes: Annotated[
int,
Option(
--passes,
-p,
min=1,
help="[bold red](🔴 Basic )[/] Number of sequential upscale passes. Gets exponentially slower and bigger images",
),
] = Field(1, gt=0)
Format ¶
Bases: str
, BrokenEnum
Source code in Broken/Externals/Upscaler/__init__.py
38 39 40 |
|
format ¶
format: Annotated[
Format,
Option(
--format,
-f,
help="[bold red](🔴 Basic )[/] Temporary image processing format. (PNG: Lossless, slow) (JPG: Good enough, faster)",
),
] = Field(Format.JPG)
quality ¶
quality: Annotated[
int,
Option(
--quality,
-q,
min=0,
max=100,
help="[bold red](🔴 Basic )[/] Temporary image processing 'PIL.Image.save' quality used on --format",
),
] = Field(95, ge=0, le=100)
output_size ¶
output_size(width: int, height: int) -> tuple[int, int]
Calculate the final output size after upscaling some input size
Source code in Broken/Externals/Upscaler/__init__.py
50 51 52 53 54 55 56 57 |
|
path_image ¶
path_image(
image: Optional[LoadableImage] = None,
) -> Iterable[Path]
Source code in Broken/Externals/Upscaler/__init__.py
59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 |
|
upscale ¶
upscale(
image: LoadableImage,
output: Union[Path, ImageType] = ImageType,
**config
) -> Union[Path, ImageType]
Upscale some input image given by its path or Image object.
Parameters:
-
input
–The input image to upscale
-
output
(Union[Path, ImageType]
, default:ImageType
) –The output path to save or
Image
class for a Image object
Returns:
-
Union[Path, ImageType]
–The upscaled image as a PIL Image object if
output
isImage
, else the output Path
Source code in Broken/Externals/Upscaler/__init__.py
78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 |
|
PillowUpscaler ¶
Bases: UpscalerBase
Source code in Broken/Externals/Upscaler/__init__.py
158 159 160 161 162 163 164 165 |
|
NoUpscaler ¶
Bases: UpscalerBase
Source code in Broken/Externals/Upscaler/__init__.py
167 168 169 170 171 172 173 174 175 176 177 |
|
upscale ¶
upscale(*args, **kwargs) -> ImageType
Source code in Broken/Externals/Upscaler/__init__.py
173 174 |
|
BrokenUpscaler ¶
BrokenUpscaler: TypeAlias = Union[
UpscalerBase,
NoUpscaler,
PillowUpscaler,
Realesr,
Upscayl,
Waifu2x,
]