With GMT.jl we can read or produce high quality images (like the one here) but the output is a MxNx2 uint8 array. And I would like to display them with Images.jl but can’t find a way to reformat the data.
I did try things around this
using FixedPointNumbers, Colors, ColorTypes
z=zeros(UInt8,2,2,3);
z[1,1,1] = 255; z[1,2,2] = 255; z[2,1,3] = 255;
imf8 = reinterpret(N0f8, z)
2×2×3 Array{FixedPointNumbers.Normed{UInt8,8},3}:
[:, :, 1] =
1.0N0f8 0.0N0f8
0.0N0f8 0.0N0f8
[:, :, 2] =
0.0N0f8 1.0N0f8
0.0N0f8 0.0N0f8
[:, :, 3] =
0.0N0f8 0.0N0f8
1.0N0f8 0.0N0f8
RGB24.(reshape(permutedims(imf8,[3 2 1])[:],2,6))
2×6 Array{ColorTypes.RGB24,2}:
RGB24{N0f8}(1.0,1.0,1.0) RGB24{N0f8}(0.0,0.0,0.0) RGB24{N0f8}(1.0,1.0,1.0) … RGB24{N0f8}(1.0,1.0,1.0) RGB24{N0f8}(0.0,0.0,0.0)
RGB24{N0f8}(0.0,0.0,0.0) RGB24{N0f8}(0.0,0.0,0.0) RGB24{N0f8}(0.0,0.0,0.0) RGB24{N0f8}(0.0,0.0,0.0) RGB24{N0f8}(0.0,0.0,0.0)
but that’s not what it takes to create a color image (a 4 pixels Red,Green,Blue,Black image in this case).
How can I do it? This problem is clearly solved by the FileIO
`load()`` function but I can’t find the code that loads an image from file and reformats the data.
Thanks.