Skip to content

Fix custom resolution validation rejecting valid multiples of 32 - #211

Open
orchie wants to merge 1 commit into
FlashML-org:mainfrom
orchie:fix/custom-resolution-validation
Open

orchie wants to merge 1 commit into
FlashML-org:mainfrom
orchie:fix/custom-resolution-validation

Conversation

@orchie

@orchie orchie commented Oct 13, 2026

Copy link
Copy Markdown

修复自定义分辨率 bug(Fix custom resolution validation)

Problem

geometry() and the latent upscaler validated dimensions with strict Python-native integer checks (isinstance(n, int) / type(n) is not int). When width/height were provided as a string from a typed widget ("640"), a numpy integer (numpy.int64), or an integer-valued float, they were wrongly rejected with:

Width and height must be multiples of 32, at least 256 pixels.

This happened even when the value was a perfectly valid multiple of 32 (e.g. 640x960). The built-in presets worked because they submit a native int, while manually entered custom values arrive as strings.

Fix

  • Normalize each dimension with float() and compare by numeric value before validating the >= 256 and % 32 constraints.
  • Apply the same normalization to the latent upscaler's target-size check (used in the second pass).
  • Non-numeric, fractional, undersized, and non-multiple-of-32 values are still correctly rejected.

Tested

Using the main environment Python, with 640x960:

  • 640, "640", 640.0, numpy.int64(640) → all accepted
  • 642 (not multiple), 128 (too small), "abc", "640.5" → all rejected

Files changed

  • freevideo_engine/geometry.py
  • freevideo_engine/latent_upscale.py

geometry() and the latent upscaler used strict Python-int checks
(isinstance(n, int) / type(n) is int). When width/height came from a
widget as a string ("640"), numpy.int64, or an integer-valued float,
they were wrongly rejected with "Width and height must be multiples of
32, at least 256 pixels", even though the value was a valid multiple of 32.

Normalize via float() and compare by numeric value before validating the
>=256 and %32 constraints. Non-numeric, fractional, undersized and
non-multiple values are still correctly rejected.

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