Skip to content

fix(sdk): preserve PA palette colors during downsizing - #3343

Open
voropaevv wants to merge 1 commit into
roboflow:mainfrom
voropaevv:codex/sdk-pa-resize-colors
Open

voropaevv wants to merge 1 commit into
roboflow:mainfrom
voropaevv:codex/sdk-pa-resize-colors

Conversation

@voropaevv

Copy link
Copy Markdown
Contributor

When SDK client-side downsizing is enabled (client_downsizing_disabled=False), resizing a Pillow PA image can lose its palette colors before JPEG encoding. An opaque input with RGB color (64, 128, 192) produces a black uploaded JPEG.

Expand PA to RGBA before an actual resize, after the no-resize guards. This uses Pillow's existing alpha-aware resampling and preserves the source image, scaling factor, other image modes and JPEG encoding policy.

The 25 regression cases cover opaque/mixed/zero alpha, nonmonotonic palettes, no-resize behavior, other modes, and actual synchronous/asynchronous SDK request bytes with prediction geometry.

Validation on 30141d2f6 against main 21059e9a5:

  • New tests: 8 failed / 17 passed on the parent, then 25 passed with the fix on both Pillow 12.3 and 13.
  • Full SDK unit suite: 696 passed / 1 existing filesystem skip on each version.
  • The 25 new cases also pass on Python 3.10 and 3.13 and against the built wheel installed into an isolated target using the existing test dependencies.
  • Regression tests reject RGB-only conversion and conversion before the no-resize guards.
  • make check_code_quality, changed-file Black/isort/Flake8 and git diff --check pass.

The existing skip concerns case-distinct filenames on this filesystem. The all-catalog SDK run additionally has two WebRTC e2e setup errors because the SDK-only environment lacks torch; the same fixture errors reproduce on the parent before server startup. No model/server/GPU inference or hosted CI result is claimed here.

The declared Pillow dependency is unchanged; Pillow 13 is extra runtime compatibility evidence. Thin-image rounding in #3241 is outside this change.

This branch has not been deployed

No deployments
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.

1 participant