upscale()
Upscales an image using a specified super-resolution model.
It accepts an image in various forms: a LazyLoadingImage instance, a PIL Image, or a string representing a URL or file path. Supports different upscaling models, customizable tile size, padding, and the number of repetitions for upscaling. It can use tiles to manage memory usage on large images and supports multiple passes for upscaling.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
img |
LazyLoadingImage | Image | str
|
The input image. |
required |
upscale_model |
str
|
Upscaling model to use. Defaults to realesrgan-x2-plus |
DEFAULT_UPSCALE_MODEL
|
tile_size |
int
|
Size of the tiles used for processing the image. Defaults to 512. |
512
|
tile_pad |
int
|
Padding size for each tile. Defaults to 50. |
50
|
repetition |
int
|
Number of times the upscaling is repeated. Defaults to 1. |
1
|
device |
The device (CPU/GPU) to be used for computation. If None, the best available device is used. |
None
|
Returns:
Type | Description |
---|---|
Image
|
Image.Image: The upscaled image as a PIL Image object. |