Skip to content

Loads different pixel values on Windows vs Linux #3833

@mikeobr

Description

@mikeobr

What did you do?

Loaded an image and checked a pixel value.

What did you expect to happen?

Identical values on windows and linux.

What actually happened?

Values differed by a visible amount.

What are your OS, Python and Pillow versions?

  • OS: Windows 10, Amazon Linux
  • Python: 3.7
  • Pillow: 6.0.0
from PIL import Image
import numpy as np
import cv2

test = Image.open("test.jpg")
print(Image.core.jpeglib_version)
print(np.array(test)[35][97])
print(cv2.imread("test.jpg")[35][97][::-1])
# output on windows 10, python 3.7, Pillow 6.0.0
# 6.2
# [188  87 145]
# [188  87 145]

# output on linux, python 3.7, pillow 6.0.0, cv2 is the same, pillow differs
# 9.0
# [196  83 147]
# [188  87 145]

test

Additional Debug info

The input image has an sRGB color profile.

Based on what I've read online, this is may be related to the jpeglib version. However I'm confused about how Pillow links to this dependency and uses it. I'm a little stuck as to how to make the code consistent between os + versions.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions