Presumed interference between FileIO and Images or FixedPointNumbers

Open
#113 11 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
35/100
Issue type
Bug
Clarity
Mostly clear
Activity status
Stale
Tech stack
julia
Domain
tooling

Research direction

Reproduce the two Julia sessions with the supplied lixa.JPG, focusing on the order of GMT image reading and FileIO.load. Start with ImageMagick/src/libmagickwand.jl and FileIO/src/loadsave.jl from the stack trace; done means identifying and resolving the order-dependent loading failure or documenting the confirmed incompatibility.

Written by the indexing model from the issue text.

Description

First, let me apologize for this kinda difficult to reproduce issue report but it depends on a interaction with a C library that I just fixed for this to work. The background is that explained in this thread

What happens is the following. Somehow the order by which I load an image is important.
This works well:

using FixedPointNumbers, Images, FileIO, GMT

julia> img1=load("lixa.JPG")
4×3 Array{RGB{N0f8},2}:
 RGB{N0f8}(0.282,0.263,0.239)  RGB{N0f8}(0.514,0.486,0.373)  RGB{N0f8}(0.89,0.843,0.694)
 RGB{N0f8}(0.216,0.176,0.137)  RGB{N0f8}(0.871,0.835,0.714)  RGB{N0f8}(0.278,0.227,0.09)
 RGB{N0f8}(0.333,0.267,0.204)  RGB{N0f8}(0.969,0.91,0.78)    RGB{N0f8}(0.298,0.239,0.11)
 RGB{N0f8}(0.596,0.502,0.408)  RGB{N0f8}(0.671,0.6,0.459)    RGB{N0f8}(0.239,0.18,0.067)

julia> I = gmt("read lixa.JPG -Ti"); imf8 = reinterpret(N0f8, I.image);

julia> img2 = colorview(RGB, imf8)
4×3 Array{RGB{N0f8},2}:
 RGB{N0f8}(0.282,0.263,0.239)  RGB{N0f8}(0.514,0.486,0.373)  RGB{N0f8}(0.89,0.843,0.694)
 RGB{N0f8}(0.216,0.176,0.137)  RGB{N0f8}(0.871,0.835,0.714)  RGB{N0f8}(0.278,0.227,0.09)
 RGB{N0f8}(0.333,0.267,0.204)  RGB{N0f8}(0.969,0.91,0.78)    RGB{N0f8}(0.298,0.239,0.11)
 RGB{N0f8}(0.596,0.502,0.408)  RGB{N0f8}(0.671,0.6,0.459)    RGB{N0f8}(0.239,0.18,0.067)

But if I just revert the order of the operations

using FixedPointNumbers, Images, FileIO, GMT

julia> I = gmt("read lixa.JPG -Ti"); imf8 = reinterpret(N0f8, I.image);

julia> img2 = colorview(RGB, imf8)
4×3 Array{RGB{N0f8},2}:
 RGB{N0f8}(0.282,0.263,0.239)  RGB{N0f8}(0.514,0.486,0.373)  RGB{N0f8}(0.89,0.843,0.694)
 RGB{N0f8}(0.216,0.176,0.137)  RGB{N0f8}(0.871,0.835,0.714)  RGB{N0f8}(0.278,0.227,0.09)
 RGB{N0f8}(0.333,0.267,0.204)  RGB{N0f8}(0.969,0.91,0.78)    RGB{N0f8}(0.298,0.239,0.11)
 RGB{N0f8}(0.596,0.502,0.408)  RGB{N0f8}(0.671,0.6,0.459)    RGB{N0f8}(0.239,0.18,0.067)

julia> img1=load("lixa.JPG")
Error encountered while loading "v:\lixa.JPG".
Fatal error:
ERROR: RegistryKeyLookupFailed `CoderModulesPath' @ error/module.c/GetMagickModulePath/666
 in error(::ImageMagick.MagickWand) at c:\j\.julia\v0.5\ImageMagick\src\libmagickwand.jl:198
 in readimage(::ImageMagick.MagickWand, ::String) at c:\j\.julia\v0.5\ImageMagick\src\libmagickwand.jl:277
 in #load_#20(::Type{T}, ::String, ::Void, ::Function, ::String) at c:\j\.julia\v0.5\ImageMagick\src\ImageMagick.jl:72
 in #load#13(::Array{Any,1}, ::Function, ::FileIO.File{FileIO.DataFormat{:JPEG}}) at c:\j\.julia\v0.5\ImageMagick\src\ImageMagick.jl:51
 in anonymous at .\<missing>:?
 in eval(::Module, ::Any) at .\boot.jl:234
 in #load#17(::Array{Any,1}, ::Function, ::FileIO.File{FileIO.DataFormat{:JPEG}}) at c:\j\.julia\v0.5\FileIO\src\loadsave.jl:87
 in load(::FileIO.File{FileIO.DataFormat{:JPEG}}) at c:\j\.julia\v0.5\FileIO\src\loadsave.jl:75
 in #load#13(::Array{Any,1}, ::Function, ::String) at c:\j\.julia\v0.5\FileIO\src\loadsave.jl:45
 in load(::String) at c:\j\.julia\v0.5\FileIO\src\loadsave.jl:45

I'm attaching the (tiny tiny) test image for the case you find it useful

lixa

Dominant language
Julia
Stars
228
Forks
83
PR merge metrics
No merged PRs in 30d

Getting set up

This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from JuliaIO/FileIO.jl

All issues in JuliaIO/FileIO.jl

Similar issues

More Julia issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.