Different image orientation in Images vs Makie

I have this (raw) image:

julia> depth1D
640×480 reshape(reinterpret(Float32, ::Array{UInt8,1}), 640, 480) with eltype Float32:

When I display it with Images, calling imshow(depth1D), I get this orientation:

When I display it with Makie, calling image(depth1D), I get different orientation:

It is not a big problem, but since I want to use both packages, I would like to be able to reconcile the differences.

Yes, this is a known quirk. In the world of image processing, the standard is to display image data in a matrix transposed and flipped along the y-axis. This makes the image have the same orientation as the matrix when it is printed numerically in the usual row-column order. Images.jl follows this convention (compare the numerical grayscale values with its image representation in this example).

Makie does not yet follow this convention. Arguably it should though (for the image() command only), and this is being discussed in several issues, e.g. #205, #389 and #524. (Note when reading the historical discussion in #205 that there was much confusion due to two different problems being discussed at once, and it took a while before everyone realized this.)

Displaying images transposed and flipped is likely to become the default in Makie too eventually, but for now you have to do it manually yourself.

1 Like