fix: normalize panel sizes in AggregateImages composite output#1214
Merged
fix: normalize panel sizes in AggregateImages composite output#1214
Conversation
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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
When
AggregateImages.output_to_folderorextract_imagecombined panels from source images with different grid layouts (e.g. a 2x2rgb.pngand a 4x3subplot_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_imageandAggregateImages.output_to_foldernow 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 optionalpanel_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 passedpytest test_autofit/aggregator/— 49 passedFull 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). IfNone, 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_imageandAggregateImages.output_to_foldernow 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
panel_size=(width, height).🤖 Generated with Claude Code