generate.py ignores EXIF orientation when loading I2V/TI2V conditioning images

Open Beginner friendly
#415 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
82/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Active
Tech stack
python

Research direction

Read generate.py around line 376, where --image is opened and converted to RGB. Check how the loaded image is used for conditioning and TI2V output-size calculation, then compare with the issue’s Pillow reproduction. Done when EXIF orientation is applied before both uses, so the portrait input gives the expected 800×1088 output at the stated size.

Written by the indexing model from the issue text.

Description

At 1ea34ff, generate.py:376 loads --image using:

Image.open(args.image).convert("RGB")

This does not apply EXIF orientation. A portrait JPEG stored with rotated pixels and Orientation=6 therefore supplies sideways conditioning and landscape dimensions.

CPU reproduction from the repository root, using Pillow:

python3 - <<'PY'
from PIL import Image, ImageOps

p = Image.open("examples/i2v_input.JPG").convert("RGB")
exif = Image.Exif()
exif[0x0112] = 6
p.rotate(90, expand=True).save(
    "portrait_exif6.jpg", quality=95, exif=exif
)

raw = Image.open("portrait_exif6.jpg").convert("RGB")
upright = ImageOps.exif_transpose(
    Image.open("portrait_exif6.jpg")
).convert("RGB")

print("source:", p.size)
print("generate.py loading:", raw.size)
print("orientation applied:", upright.size)
PY

Output:

source: (832, 1104)
generate.py loading: (1104, 832)
orientation applied: (832, 1104)

Expected: apply the orientation before conditioning and output-size calculation. With TI2V and --size '1280*704', these two image dimensions produce 1088×800 and 800×1088 outputs respectively.

Applying ImageOps.exif_transpose before RGB conversion would normalize the input.

Found and reproduced with AI assistance; the repro above was run by me.

Dominant language
Python
Stars
17.9k
Forks
2.3k
PR merge metrics
No merged PRs in 30d

Getting set up

This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from Wan-Video/Wan2.2

All issues in Wan-Video/Wan2.2

Similar issues

More Python issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.