You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
importnumpyasnpfromPILimportImagefromtorchvision.ioimportread_image, ImageReadModefromtorchvision.transformsimportToPILImage# Using PIL:pil_notinterlaced=Image.open("wizard.png")
pil_interlaced=Image.open("wizard-interlaced.png")
# PASSassertnp.all( np.asarray(pil_notinterlaced) ==np.asarray(pil_interlaced) ), "differences btw interlaced and non-interlaced images loaded with PIL"# Using torchvision:tv_notinterlaced=read_image("wizard.png")
tv_interlaced=read_image("wizard-interlaced.png")
# PASSasserttv_notinterlaced.shape==tv_interlaced.shape, "not the same shape"# FAILassert (tv_notinterlaced==tv_interlaced).all(), "differences btw interlaced and non-interlaced images loaded with torchvision"# ... (for manual comparison) convert the interlaced image tensor to PIL and savetopil=ToPILImage()
topil(tv_interlaced).save("wizard-interlaced-savedfromtv.png")
wizard.png:
wizard-interlaced.png:
wizard-interlaced-savedfromtv.png:
Expected behavior
Using read_image to load an interlaced PNG image would automatically de-interlace it.
Environment
Collecting environment information...
PyTorch version: 1.9.0
Is debug build: False
CUDA used to build PyTorch: None
ROCM used to build PyTorch: N/A
OS: macOS 11.4 (x86_64)
GCC version: Could not collect
Clang version: 12.0.0 (clang-1200.0.32.2)
CMake version: version 3.17.3
Libc version: N/A
Python version: 3.8.8 (default, Feb 24 2021, 13:46:16) [Clang 10.0.0 ] (64-bit runtime)
Python platform: macOS-10.16-x86_64-i386-64bit
Is CUDA available: False
CUDA runtime version: No CUDA
GPU models and configuration: No CUDA
Nvidia driver version: No CUDA
cuDNN version: No CUDA
HIP runtime version: N/A
MIOpen runtime version: N/A
Versions of relevant libraries:
[pip3] numpy==1.21.0
[pip3] torch==1.9.0
[pip3] torchtext==0.10.0
[pip3] torchvision==0.10.0
[conda] blas 1.0 mkl
[conda] ffmpeg 4.3 h0a44026_0 pytorch
[conda] mkl 2021.3.0 hecd8cb5_517
[conda] mkl-service 2.4.0 py38h9ed2024_0
[conda] mkl_fft 1.3.0 py38h4a7008c_2
[conda] mkl_random 1.2.2 py38hb2f4e1b_0
[conda] numpy 1.21.0 pypi_0 pypi
[conda] numpy-base 1.20.3 py38he0bd621_0
[conda] pytorch 1.9.0 py3.8_0 pytorch
[conda] torchtext 0.10.0 py38 pytorch
[conda] torchvision 0.10.0 py38_cpu pytorch
Additional context
I reproduced the issue handling interlaced PNGs on a linux machine running centos 7 w/ similar python specs and using other interlaced PNG images that had not been converted by imagemagick.
The text was updated successfully, but these errors were encountered:
🐛 Bug
Interlaced PNG files are not de-interlaced when loaded by
read_image
.To Reproduce
Steps to reproduce the behavior:
read_image
toPIL.Image.open
wizard.png
:wizard-interlaced.png
:wizard-interlaced-savedfromtv.png
:Expected behavior
Using
read_image
to load an interlaced PNG image would automatically de-interlace it.Environment
Additional context
I reproduced the issue handling interlaced PNGs on a linux machine running centos 7 w/ similar python specs and using other interlaced PNG images that had not been converted by imagemagick.
The text was updated successfully, but these errors were encountered: