Skip to content

fix: normalize panel sizes in AggregateImages composite output#1214

Merged
Jammy2211 merged 1 commit intomainfrom
feature/aggregator-output-png
Apr 14, 2026
Merged

fix: normalize panel sizes in AggregateImages composite output#1214
Jammy2211 merged 1 commit intomainfrom
feature/aggregator-output-png

Conversation

@Jammy2211
Copy link
Copy Markdown
Collaborator

Summary

When AggregateImages.output_to_folder or extract_image combined panels from source images with different grid layouts (e.g. a 2x2 rgb.png and a 4x3 subplot_fit.png), panels were pasted at their native pixel sizes. The RGB panel appeared roughly half the width and height of the fit panels in the composite. Closes #1213.

API Changes

AggregateImages.extract_image and AggregateImages.output_to_folder now resize every extracted panel to a common size before compositing. The default target is the maximum width and height across all panels (no user action needed to get consistent panel sizes). A new optional panel_size=(width, height) keyword argument was added to both methods to override the default. See full details below.

Test Plan

  • pytest test_autofit/aggregator/summary_files/test_aggregate_images.py — 13 passed
  • pytest test_autofit/aggregator/ — 49 passed
Full API Changes (for automation & release notes)

Added

  • AggregateImages.extract_image(..., panel_size: Optional[Tuple[int, int]] = None) — new keyword argument. If provided, all panels are resized to this (width, height). If None, panels are resized to the max width and height across all panels.
  • AggregateImages.output_to_folder(..., panel_size: Optional[Tuple[int, int]] = None) — new keyword argument with the same semantics as above.
  • AggregateImages._normalize_panel_sizes(matrix, panel_size=None) — internal staticmethod that performs the LANCZOS resizing pass.

Changed Behaviour

  • AggregateImages.extract_image and AggregateImages.output_to_folder now always resize panels to a common size before compositing. Previously, panels from source images with different grid layouts composited at mismatched sizes. Callers that relied on the previous behaviour (mixed-size panels in the composite) will see different output dimensions; this is the fix.

Migration

  • No action required for the default case — the fix is transparent and produces visually-consistent panels.
  • If you want panels at a specific size (e.g. for printing), pass panel_size=(width, height).

🤖 Generated with Claude Code

Panels extracted from source images with different grid layouts (e.g. a
2x2 rgb.png and a 4x3 subplot_fit.png) previously ended up at different
pixel dimensions, so the RGB panel appeared half the size of the fit
panels in the composite.

Add `_normalize_panel_sizes` that resizes every panel to a common target
size with LANCZOS resampling before compositing. The target is the max
width/height across all panels by default, or an explicit `panel_size`
`(width, height)` tuple passed to `extract_image` / `output_to_folder`.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@Jammy2211 Jammy2211 merged commit cebec12 into main Apr 14, 2026
2 checks passed
@Jammy2211 Jammy2211 deleted the feature/aggregator-output-png branch April 14, 2026 18:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

fix: normalize panel sizes in AggregateImages composite output

1 participant