From ffb99d3e661484f36e1ddb091f148db25201c2b2 Mon Sep 17 00:00:00 2001 From: Ethanfel Date: Sat, 11 Apr 2026 23:39:42 +0200 Subject: [PATCH] =?UTF-8?q?fix:=20scale=20random=20portrait=20count=20?= =?UTF-8?q?=E2=80=94=201=20per=203=20clips=20(e.g.=202=20for=206=20clips)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-Authored-By: Claude Sonnet 4.6 --- main.py | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/main.py b/main.py index f05507d..705da71 100755 --- a/main.py +++ b/main.py @@ -1684,13 +1684,15 @@ class MainWindow(QMainWindow): out = build_export_path(folder, name, self._export_counter, sub=sub) jobs.append((start, out, base_ratio, base_center)) - # Random portrait: pick one clip, give it a random ratio + position + # Random portrait: ~1 per 3 clips gets a random ratio + position if self._chk_rand_portrait.isChecked() and n_clips > 1: - idx = random.randrange(n_clips) - rand_ratio = random.choice(list(_RATIOS.keys())) - rand_center = random.random() - s, o, _, _ = jobs[idx] - jobs[idx] = (s, o, rand_ratio, rand_center) + n_portrait = max(1, n_clips // 3) + indices = random.sample(range(n_clips), n_portrait) + for idx in indices: + rand_ratio = random.choice(list(_RATIOS.keys())) + rand_center = random.random() + s, o, _, _ = jobs[idx] + jobs[idx] = (s, o, rand_ratio, rand_center) raw = self._txt_resize.text().strip() try: