diff options
author | AUTOMATIC1111 <16777216c@gmail.com> | 2023-03-11 13:45:35 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-03-11 13:45:35 +0000 |
commit | d3dd6cc01c70516b0b3406d87cd0f6a682c78b86 (patch) | |
tree | cb29d89dcf14d7cd057796bf87f4acae5b9a26e9 /scripts/xyz_grid.py | |
parent | 76bc72116e2576b887e3ec8619c9c0f54a151f7a (diff) | |
parent | a47c18297e1611568c732e6e6922d5be9def7c47 (diff) | |
download | stable-diffusion-webui-gfx803-d3dd6cc01c70516b0b3406d87cd0f6a682c78b86.tar.gz stable-diffusion-webui-gfx803-d3dd6cc01c70516b0b3406d87cd0f6a682c78b86.tar.bz2 stable-diffusion-webui-gfx803-d3dd6cc01c70516b0b3406d87cd0f6a682c78b86.zip |
Merge pull request #8175 from vladmandic/image_size
adds checks for resulting image size to avoid memory issues
Diffstat (limited to 'scripts/xyz_grid.py')
-rw-r--r-- | scripts/xyz_grid.py | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/scripts/xyz_grid.py b/scripts/xyz_grid.py index 87e33d79..84c73e28 100644 --- a/scripts/xyz_grid.py +++ b/scripts/xyz_grid.py @@ -499,6 +499,11 @@ 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)
+ assert grid_mp < opts.img_max_size_mp, 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]
|