2023-01-28 15:08:59 +00:00
|
|
|
from PIL import Image
|
|
|
|
|
|
|
|
|
|
|
|
from ..params import (
|
|
|
|
ImageParams,
|
|
|
|
StageParams,
|
|
|
|
)
|
|
|
|
from ..utils import (
|
2023-01-28 15:15:02 +00:00
|
|
|
base_join,
|
2023-01-28 15:08:59 +00:00
|
|
|
ServerContext,
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
def persist_disk(
|
|
|
|
ctx: ServerContext,
|
|
|
|
stage: StageParams,
|
|
|
|
params: ImageParams,
|
|
|
|
source_image: Image.Image,
|
|
|
|
*,
|
|
|
|
output: str,
|
|
|
|
) -> Image.Image:
|
2023-01-28 15:15:02 +00:00
|
|
|
dest = base_join(ctx.output_path, output)
|
|
|
|
source_image.save(dest)
|
|
|
|
print('saved image to %s' % (dest,))
|
2023-01-28 15:08:59 +00:00
|
|
|
return source_image
|