Hi, I've noticed that if I want to use GaussianMixtures.jl in a package where I also want to save images, the method for Images.save breaks. I think this is because of the method overload of FileIO.save done here. E.g.
using GaussianMixtures
using Images
img = rand(Gray{N0f8}, (10, 10))
Images.save("im.png", img)
And this gives the error
Warning: Mapping to the storage type failed; perhaps your data had out-of-range values?
│ Try `map(clamp01nan, img)` to clamp values to a valid range.
└ @ ImageMagick ~/.julia/packages/ImageMagick/Fh2BX/src/ImageMagick.jl:179
Errors encountered while save FileIO.File{FileIO.DataFormat{:PNG}, String}("im.png").
All errors:
===========================================
MethodError: no method matching save(::FileIO.File{FileIO.DataFormat{:PNG}, String}, ::String, ::Matrix{Gray{N0f8}})
Closest candidates are:
save(::FileIO.File{FileIO.DataFormat{:EXR}, Name} where Name, ::Any...; kwargs...) at /home/ben/.julia/packages/ImageIO/xMHN9/src/ImageIO.jl:141
save(::FileIO.File{FileIO.DataFormat{:QOI}, Name} where Name, ::Any...; kwargs...) at /home/ben/.julia/packages/ImageIO/xMHN9/src/ImageIO.jl:152
save(::FileIO.File{FileIO.DataFormat{:PNG}, Name} where Name, ::S; kwargs...) where {T, S<:Union{AbstractArray{T, 3}, AbstractMatrix{T} where T}} at /home/ben/.julia/packages/ImageIO/xMHN9/src/ImageIO.jl:69
===========================================
MethodError: no method matching mapIM(::Char)
Closest candidates are:
mapIM(::RGB{T}) where T<:Normed at /home/ben/.julia/packages/ImageMagick/Fh2BX/src/ImageMagick.jl:310
mapIM(::RGB{T}) where T at /home/ben/.julia/packages/ImageMagick/Fh2BX/src/ImageMagick.jl:309
mapIM(::GrayA{T}) where T<:Normed at /home/ben/.julia/packages/ImageMagick/Fh2BX/src/ImageMagick.jl:306
...
===========================================
MethodError: no method matching save(::FileIO.File{FileIO.DataFormat{:PNG}, String}, ::String, ::Matrix{Gray{N0f8}})
Closest candidates are:
save(::FileIO.File{FileIO.DataFormat{:PNG}, Name} where Name, ::Any) at /home/ben/.julia/packages/FileIO/aP78L/src/mimesave.jl:5
save(::FileIO.File{FileIO.DataFormat{:SVG}, Name} where Name, ::Any) at /home/ben/.julia/packages/FileIO/aP78L/src/mimesave.jl:15
save(::FileIO.File{FileIO.DataFormat{:PDF}, Name} where Name, ::Any) at /home/ben/.julia/packages/FileIO/aP78L/src/mimesave.jl:25
...
===========================================
Fatal error:
ERROR: MethodError: no method matching save(::FileIO.File{FileIO.DataFormat{:PNG}, String}, ::String, ::Matrix{Gray{N0f8}})
Closest candidates are:
save(::FileIO.File{FileIO.DataFormat{:EXR}, Name} where Name, ::Any...; kwargs...) at /home/ben/.julia/packages/ImageIO/xMHN9/src/ImageIO.jl:141
save(::FileIO.File{FileIO.DataFormat{:QOI}, Name} where Name, ::Any...; kwargs...) at /home/ben/.julia/packages/ImageIO/xMHN9/src/ImageIO.jl:152
save(::FileIO.File{FileIO.DataFormat{:PNG}, Name} where Name, ::S; kwargs...) where {T, S<:Union{AbstractArray{T, 3}, AbstractMatrix{T} where T}} at /home/ben/.julia/packages/ImageIO/xMHN9/src/ImageIO.jl:69
Stacktrace:
[1] invokelatest(::Any, ::Any, ::Vararg{Any, N} where N; kwargs::Base.Iterators.Pairs{Union{}, Union{}, Tuple{}, NamedTuple{(), Tuple{}}})
@ Base ./essentials.jl:708
[2] invokelatest(::Any, ::Any, ::Vararg{Any, N} where N)
@ Base ./essentials.jl:706
[3] action(::Symbol, ::Vector{Union{Base.PkgId, Module}}, ::FileIO.Formatted, ::String, ::Vararg{Any, N} where N; options::Base.Iterators.Pairs{Union{}, Union{}, Tuple{}, NamedTuple{(), Tuple{}}})
@ FileIO ~/.julia/packages/FileIO/aP78L/src/loadsave.jl:219
[4] action(::Symbol, ::Vector{Union{Base.PkgId, Module}}, ::FileIO.Formatted, ::String, ::Matrix{Gray{N0f8}})
@ FileIO ~/.julia/packages/FileIO/aP78L/src/loadsave.jl:197
[5] action(::Symbol, ::Vector{Union{Base.PkgId, Module}}, ::Symbol, ::String, ::String, ::Vararg{Any, N} where N; options::Base.Iterators.Pairs{Union{}, Union{}, Tuple{}, NamedTuple{(), Tuple{}}})
@ FileIO ~/.julia/packages/FileIO/aP78L/src/loadsave.jl:185
[6] action(::Symbol, ::Vector{Union{Base.PkgId, Module}}, ::Symbol, ::String, ::String, ::Vararg{Any, N} where N)
@ FileIO ~/.julia/packages/FileIO/aP78L/src/loadsave.jl:185
[7] save(::String, ::String, ::Vararg{Any, N} where N; options::Base.Iterators.Pairs{Union{}, Union{}, Tuple{}, NamedTuple{(), Tuple{}}})
@ FileIO ~/.julia/packages/FileIO/aP78L/src/loadsave.jl:129
[8] save
@ ~/.julia/packages/FileIO/aP78L/src/loadsave.jl:126 [inlined]
[9] save(file::String, x::Matrix{Gray{N0f8}})
@ GaussianMixtures ~/.julia/packages/GaussianMixtures/zDaBV/src/data.jl:33
[10] top-level scope
@ REPL[8]:1
Stacktrace:
[1] handle_error(e::MethodError, q::Base.PkgId, bt::Vector{Union{Ptr{Nothing}, Base.InterpreterIP}})
@ FileIO ~/.julia/packages/FileIO/aP78L/src/error_handling.jl:61
[2] handle_exceptions(exceptions::Vector{Tuple{Any, Union{Base.PkgId, Module}, Vector{T} where T}}, action::String)
@ FileIO ~/.julia/packages/FileIO/aP78L/src/error_handling.jl:56
[3] action(::Symbol, ::Vector{Union{Base.PkgId, Module}}, ::FileIO.Formatted, ::String, ::Vararg{Any, N} where N; options::Base.Iterators.Pairs{Union{}, Union{}, Tuple{}, NamedTuple{(), Tuple{}}})
@ FileIO ~/.julia/packages/FileIO/aP78L/src/loadsave.jl:228
[4] action(::Symbol, ::Vector{Union{Base.PkgId, Module}}, ::FileIO.Formatted, ::String, ::Matrix{Gray{N0f8}})
@ FileIO ~/.julia/packages/FileIO/aP78L/src/loadsave.jl:197
[5] action(::Symbol, ::Vector{Union{Base.PkgId, Module}}, ::Symbol, ::String, ::String, ::Vararg{Any, N} where N; options::Base.Iterators.Pairs{Union{}, Union{}, Tuple{}, NamedTuple{(), Tuple{}}})
@ FileIO ~/.julia/packages/FileIO/aP78L/src/loadsave.jl:185
[6] action(::Symbol, ::Vector{Union{Base.PkgId, Module}}, ::Symbol, ::String, ::String, ::Vararg{Any, N} where N)
@ FileIO ~/.julia/packages/FileIO/aP78L/src/loadsave.jl:185
[7] save(::String, ::String, ::Vararg{Any, N} where N; options::Base.Iterators.Pairs{Union{}, Union{}, Tuple{}, NamedTuple{(), Tuple{}}})
@ FileIO ~/.julia/packages/FileIO/aP78L/src/loadsave.jl:129
[8] save
@ ~/.julia/packages/FileIO/aP78L/src/loadsave.jl:126 [inlined]
[9] save(file::String, x::Matrix{Gray{N0f8}})
@ GaussianMixtures ~/.julia/packages/GaussianMixtures/zDaBV/src/data.jl:33
[10] top-level scope
@ REPL[8]:1
Hi, I've noticed that if I want to use GaussianMixtures.jl in a package where I also want to save images, the method for
Images.save
breaks. I think this is because of the method overload ofFileIO.save
done here. E.g.And this gives the error