1
0
Fork 0

feat: add noise source with solid color

This commit is contained in:
Sean Sube 2023-01-15 14:26:04 -06:00
parent 16108ae172
commit 5bb3f6c558
3 changed files with 22 additions and 8 deletions

View File

@ -40,7 +40,7 @@ def mask_filter_gaussian_screen(mask_image: Image, dims: Tuple[int, int], origin
return noise return noise
def noise_source_fill(source_image: Image, dims: Tuple[int, int], origin: Tuple[int, int], fill='white') -> Image: def noise_source_fill_edge(source_image: Image, dims: Tuple[int, int], origin: Tuple[int, int], fill='white') -> Image:
''' '''
Identity transform, source image centered on white canvas. Identity transform, source image centered on white canvas.
''' '''
@ -52,6 +52,17 @@ def noise_source_fill(source_image: Image, dims: Tuple[int, int], origin: Tuple[
return noise return noise
def noise_source_fill_mask(source_image: Image, dims: Tuple[int, int], origin: Tuple[int, int], fill='white') -> Image:
'''
Fill the whole canvas, no source or noise.
'''
width, height = dims
noise = Image.new('RGB', (width, height), fill)
return noise
def noise_source_gaussian(source_image: Image, dims: Tuple[int, int], origin: Tuple[int, int], rounds=3) -> Image: def noise_source_gaussian(source_image: Image, dims: Tuple[int, int], origin: Tuple[int, int], rounds=3) -> Image:
''' '''
Gaussian blur, source image centered on white canvas. Gaussian blur, source image centered on white canvas.

View File

@ -36,10 +36,11 @@ from .image import (
mask_filter_gaussian_screen, mask_filter_gaussian_screen,
mask_filter_none, mask_filter_none,
# noise sources # noise sources
noise_source_fill_edge,
noise_source_fill_mask,
noise_source_gaussian, noise_source_gaussian,
noise_source_histogram, noise_source_histogram,
noise_source_normal, noise_source_normal,
noise_source_fill,
noise_source_uniform, noise_source_uniform,
) )
@ -86,7 +87,8 @@ pipeline_schedulers = {
'pndm': PNDMScheduler, 'pndm': PNDMScheduler,
} }
noise_sources = { noise_sources = {
'fill': noise_source_fill, 'fill-edge': noise_source_fill_edge,
'fill-mask': noise_source_fill_mask,
'gaussian': noise_source_gaussian, 'gaussian': noise_source_gaussian,
'histogram': noise_source_histogram, 'histogram': noise_source_histogram,
'normal': noise_source_normal, 'normal': noise_source_normal,

View File

@ -28,11 +28,12 @@ export const SCHEDULER_LABELS: Record<string, string> = {
}; };
export const NOISE_LABELS: Record<string, string> = { export const NOISE_LABELS: Record<string, string> = {
fill: 'Fill Edges', 'fill-edge': 'Fill Edges',
gaussian: 'Gaussian Blur', 'fill-mask': 'Fill Masked',
histogram: 'Histogram Noise', 'gaussian': 'Gaussian Blur',
normal: 'Gaussian Noise', 'histogram': 'Histogram Noise',
uniform: 'Uniform Noise', 'normal': 'Gaussian Noise',
'uniform': 'Uniform Noise',
}; };
export const MASK_LABELS: Record<string, string> = { export const MASK_LABELS: Record<string, string> = {