pytorch / pytorch/vision

Investigate why PIL and LibJPEG pixel values don't match for CMYK images

Open
#3,012 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

module: io
Dominant language
Python
Stars
17.9k
Forks
7.3k
Avg merge
1d 15h
Merged PRs (30d)
13

Description

Loading a CMYK image using libJpeg seems to yield different results than loading it with PIL.

More specifically the pixel values of img_ljpeg == 255 - img_pil:
https://github.com/pytorch/vision/blob/ada56a2442282752ccb83c935e10cb4fbbc0c8d5/test/test_image.py#L55-L69

We should investigate if that discrepancy is a bug on the way we use libjpeg.

Contributor guide

Open the contributing guide

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.

Research direction

Start with test/test_image.py lines 55-69 and compare the CMYK pixel values produced by PIL and libjpeg. Investigate whether the inversion discrepancy comes from how libjpeg is used; the work is done when the cause is identified and any resulting bug is addressed or clearly documented.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
computer-vision
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.