moose Claude Opus 4.7 (1M context) commited on
Commit
09cc589
·
1 Parent(s): 7a46cb6

Derive output aspect ratio from first image, not last

Browse files

Multi-image edits were inheriting the second input's aspect ratio
because output dimensions were calculated from image[-1]. Use image[0]
so the subject/canvas (slot 1) drives output size.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>

qwenimage/pipeline_qwenimage_edit_plus.py CHANGED
@@ -625,7 +625,7 @@ class QwenImageEditPlusPipeline(DiffusionPipeline, QwenImageLoraLoaderMixin):
625
  [`~pipelines.qwenimage.QwenImagePipelineOutput`] if `return_dict` is True, otherwise a `tuple`. When
626
  returning a tuple, the first element is a list with the generated images.
627
  """
628
- image_size = image[-1].size if isinstance(image, list) else image.size
629
  calculated_width, calculated_height = calculate_dimensions(1024 * 1024, image_size[0] / image_size[1])
630
  height = height or calculated_height
631
  width = width or calculated_width
 
625
  [`~pipelines.qwenimage.QwenImagePipelineOutput`] if `return_dict` is True, otherwise a `tuple`. When
626
  returning a tuple, the first element is a list with the generated images.
627
  """
628
+ image_size = image[0].size if isinstance(image, list) else image.size
629
  calculated_width, calculated_height = calculate_dimensions(1024 * 1024, image_size[0] / image_size[1])
630
  height = height or calculated_height
631
  width = width or calculated_width