Skip to content

load() on a TIFF image returns all 0xffff #99

@kbarbary

Description

@kbarbary

I have a few images I'm trying to read where load() returns an array of all Grey{N0f16}(1.0), but this doesn't seem to be the true file contents when read with other tools. An example image is here: https://www.dropbox.com/s/lelfacepaxvaf6w/testcase.tif?dl=0

julia> using Images

julia> img = load("testcase.tif")
256×256 Array{Gray{N0f16},2}:
 Gray{N0f16}(1.0)  Gray{N0f16}(1.0)    Gray{N0f16}(1.0)  Gray{N0f16}(1.0)
 Gray{N0f16}(1.0)  Gray{N0f16}(1.0)     Gray{N0f16}(1.0)  Gray{N0f16}(1.0)
 
julia> all(img .== Gray{N0f16}(1.0))
true

julia> using ImageMagick

julia> ImageMagick.libversion
v"6.8.9"

julia> Pkg.installed("ImageMagick")
v"0.4.0"

julia> versioninfo()
Julia Version 0.6.0-rc2.0
Commit 68e911b (2017-05-18 02:31 UTC)
Platform Info:
  OS: Linux (x86_64-pc-linux-gnu)
  CPU: Intel(R) Core(TM) i7-4500U CPU @ 1.80GHz
  WORD_SIZE: 64
  BLAS: libopenblas (USE64BITINT DYNAMIC_ARCH NO_AFFINITY Haswell)
  LAPACK: libopenblas64_
  LIBM: libopenlibm
  LLVM: libLLVM-3.9.1 (ORCJIT, haswell)

In Python, I can load the same image with cv2, and get the correct shape of (256, 256, 4) and non-constant data:

In [1]: import cv2

In [4]: img = cv2.imread("testcase.tif", -1)

In [5]: img.shape
Out[5]: (256, 256, 4)

In [6]: img[0:3, 0:3]
Out[6]: 
array([[[12181, 13224, 13839,  9250],
        [12251, 13337, 13836,  9279],
        [12312, 13407, 13951,  9316]],

       [[12033, 13128, 13720,  9271],
        [12060, 13093, 13628,  9350],
        [11967, 13088, 13505,  9414]],

       [[11627, 12659, 13098,  9057],
        [11770, 12823, 13210,  9163],
        [11796, 12774, 13330,  9244]]], dtype=uint16)

I suppose this might be a libmagickwand problem, but any advice would be appreciated!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions