Skip to content

Comments

support PIL Image objects in image conditioning functions#124

Open
Fredy Rivera (FredyRivera-dev) wants to merge 1 commit intoLightricks:mainfrom
FredyRivera-dev:main
Open

support PIL Image objects in image conditioning functions#124
Fredy Rivera (FredyRivera-dev) wants to merge 1 commit intoLightricks:mainfrom
FredyRivera-dev:main

Conversation

@FredyRivera-dev

PIL.Image object support in image conditioning

Description

Adds compatibility with PIL.Image objects in the image conditioning functions, allowing in-memory images to be passed directly instead of requiring a path on disk.

Previously, the conditioning functions only accepted a str with the image path, forcing integrators to save the image to disk before using it. This is impractical in programmatic use cases where the image is already available in memory, for example when coming from an API, a byte stream, or a pipeline that generates images on the fly.

Changes

ltx_pipelines/utils/media_io.py

  • load_image_conditioning: the image_path parameter now accepts Union[str, Image.Image]. If a PIL object is received, the new decode_image_pil is called; otherwise the original flow with decode_image is preserved.
  • Adds decode_image_pil(image: Image.Image) -> np.ndarray, which converts the PIL object directly to a NumPy array without reading from disk.

ltx_pipelines/utils/helpers.py

  • image_conditionings_by_replacing_latent: images parameter type updated to list[tuple[Union[str, Image.Image], int, float]].
  • image_conditionings_by_adding_guiding_latent: same type change in images.

ltx_pipelines/ti2vid_two_stages.py

  • TI2VidTwoStagesPipeline: images parameter type updated to list[tuple[Union[str, Image.Image], int, float]].

Compatibility

All changes are fully backwards compatible. Any existing code passing paths as str continues to work without modifications.

@FredyRivera-dev
Copy link
Author

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