diff options
author | Vladimir Mandic <mandic00@live.com> | 2023-02-27 22:28:04 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-02-27 22:28:04 +0000 |
commit | 3c6459154fb115ea7cf1a0c5f3f0761a192dfea3 (patch) | |
tree | a7b1769f444001d2fdbb2a32823b1adc1e18b3cb /scripts/xyz_grid.py | |
parent | 0cc0ee1bcb4c24a8c9715f66cede06601bfc00c8 (diff) | |
download | stable-diffusion-webui-gfx803-3c6459154fb115ea7cf1a0c5f3f0761a192dfea3.tar.gz stable-diffusion-webui-gfx803-3c6459154fb115ea7cf1a0c5f3f0761a192dfea3.tar.bz2 stable-diffusion-webui-gfx803-3c6459154fb115ea7cf1a0c5f3f0761a192dfea3.zip |
add check for resulting image size
Diffstat (limited to 'scripts/xyz_grid.py')
-rw-r--r-- | scripts/xyz_grid.py | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/scripts/xyz_grid.py b/scripts/xyz_grid.py index 53511b12..1ba954ac 100644 --- a/scripts/xyz_grid.py +++ b/scripts/xyz_grid.py @@ -484,6 +484,12 @@ class Script(scripts.Script): z_opt = self.current_axis_options[z_type]
zs = process_axis(z_opt, z_values)
+ # this could be moved to common code, but unlikely to be ever triggered anywhere else
+ Image.MAX_IMAGE_PIXELS = opts.img_max_size_mp * 1.1 # allow 10% overhead for margins and legend
+ grid_mp = round(len(xs) * len(ys) * len(zs) * p.width * p.height / 1000000)
+ if grid_mp > opts.img_max_size_mp:
+ return Processed(p, [], p.seed, info=f'Error: Resulting grid would be too large ({grid_mp} MPixels) (max configured size is {opts.img_max_size_mp} MPixels)')
+
def fix_axis_seeds(axis_opt, axis_list):
if axis_opt.label in ['Seed', 'Var. seed']:
return [int(random.randrange(4294967294)) if val is None or val == '' or val == -1 else val for val in axis_list]
|