Skip to content

Fix image processing in xcassets.py - #994

Merged
AndreMiras merged 1 commit into
kivy:masterfrom
Novfensec:xcassets
Apr 18, 2026
Merged

Fix image processing in xcassets.py#994
AndreMiras merged 1 commit into
kivy:masterfrom
Novfensec:xcassets

Conversation

@Novfensec

@Novfensec Novfensec commented Apr 18, 2026

Copy link
Copy Markdown
Contributor

So, here is a clean PR to just update the _generate and _buildimage algorithm of xcassets so images are generated correctly without any size conflicts.

Details of changes:

  • Added .convert("RGBA") in line 676 to prevent pillow crashes while reading an image.
  • Changed the sips flag from -Z to -z and passed the dimension twice (c, c) in line 706. The old -Z flag only constrained the maximum dimension while keeping the original aspect ratio, which often resulted in the wrong overall dimensions. The lowercase -z strictly forces the exact height and width required by Xcode.
  • Wrapped size in tuple(size) for Image.new() in line 688.

@AndreMiras AndreMiras left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thanks for the scoped fix

@AndreMiras
AndreMiras merged commit ebc3a1e into kivy:master Apr 18, 2026
9 checks passed
AndreMiras added a commit that referenced this pull request Apr 18, 2026
Cover the two behavior changes from PR #994:
- _buildimage must not crash on palette-mode PNGs ("P")
- _generate must invoke sips with -z H W (force exact
  square) instead of -Z max (bounding box only)

Plus baseline coverage for _buildimage padding/resize and
the launchimage code path. Tests run on Linux (no sips
required) by mocking sh.sips for the icon path.

Wire a new `unit_tests` job into the CI workflow running
on ubuntu-latest. Kept off macOS on purpose: the absence
of `sips` and friends enforces hermetic mocking in the
unit layer, and Ubuntu runners are ~10x cheaper and
faster. macOS integration coverage stays in the existing
build_python3_kivy* jobs.
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.

2 participants