save error with ImageMagick (Windows)
pdimens opened this issue · comments
I haven't tested this on a *nix machine, but with a fresh install of VegaLite.jl and ImageMagick.jl, piping a barplot into save("somefile.png")
gives this 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 C:\Users\pdime\.julia\packages\ImageMagick\mNZBN\src\ImageMagick.jl:180
Errors encountered while save FileIO.File{FileIO.DataFormat{:PNG},String}("static/img/fstplot.png").
All errors:
===========================================
ImageIO writer error: neither save nor fileio_save is defined
due to MethodError(ImageIO.save, (FileIO.File{FileIO.DataFormat{:PNG},String}("static/img/fstplot.png"), VegaLite.VLSpec), 0x0000000000006cf3)
Will try next loader.
===========================================
ImageMagick writer error: neither save nor fileio_save is defined
due to MethodError(iterate, (VegaLite.VLSpec,), 0x0000000000006d06)
Will try next loader.
===========================================
Fatal error:
ERROR: LoadError: ImageIO writer error: neither save nor fileio_save is defined
due to MethodError(ImageIO.save, (FileIO.File{FileIO.DataFormat{:PNG},String}("static/img/fstplot.png"), VegaLite.VLSpec), 0x0000000000006cf3)
Will try next loader.
The plot is a simple bar plot with three values [1.17, 0.804799, 119.48]
However, saving the plot as a variable and calling save
separately works fine:
someplot = @vlplot(etc...)
save("path/to/loc", someplot)
Can you write a test which captures this behavior on a PR?
E.g. add a test with a minimal reproducible example here on a forked version of the library? The github actions CI/CD tests Unix, Windows and Mac, so the source of the error should show up in the logs. :)
https://github.com/queryverse/VegaLite.jl/blob/master/test/test_io.jl
Sure. I wrote a test comparing the behavior with #363
Hey! One thing I noticed:
Your example with the pipe uses arg1=plot, arg2= path, but the appropriate syntax is the opposite:
p |> x->save(joinpath(pwd(), "testplot.png"), x)
I looked at your MWE again and think that it's already covered by the following test (so I don't think a PR is necessary):
save(joinpath(folder,"test3.png"), p)
This is an upstream bug that was introduced in FileIO v.1.6.0, see here.
@pdimens Then we definitely want that test! ;) I think you can just add it below the test I quoted though (as a one liner using the existing 'p' object which is used by the other tests
@pdimens You can use @test_broken
to signify that the functionality should work, but does not at the moment
I guess that works. Whatever makes most sense for y'all.
I think this is now resolve, right? Closing for now.
I'm still seeing this issue. Here is the warning and my Julia environment:
┌ 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/b8swT/src/ImageMagick.jl:180
Julia environment
(@v1.6) pkg> status
Status `~/.julia/environments/v1.6/Project.toml`
[c7e460c6] ArgParse v1.1.4
[8e7c35d0] BlockArrays v0.15.3
[336ed68f] CSV v0.8.4
[159f3aea] Cairo v1.0.5
[54eefc05] Cascadia v1.0.1
[35d6a980] ColorSchemes v3.12.1
[5ae59095] Colors v0.12.8
[150eb455] CoordinateTransformations v0.6.1
[a8cc5b0e] Crayons v4.0.4
[a93c6f00] DataFrames v1.1.1
[ffa9a821] DocumentFormat v3.2.0
[5789e2e9] FileIO v1.9.0
[186bb1d3] Fontconfig v0.4.0
[c91e804a] Gadfly v1.3.3
[708ec375] Gumbo v0.8.0
[cd3eb016] HTTP v0.9.8
[a09fc81d] ImageCore v0.8.22
[6218d12a] ImageMagick v1.2.1
[02fcd773] ImageTransformations v0.8.12
[916415d5] Images v0.24.1
[a98d9a8b] Interpolations v0.13.2
[682c06a0] JSON v0.21.1
[98e50ef6] JuliaFormatter v0.13.10
[2b0e0bc5] LanguageServer v3.2.0
[5fb14364] OhMyREPL v0.5.10
[b98c9c47] Pipe v1.3.0
[91a5bcdd] Plots v1.15.1
[08abe8d2] PrettyTables v1.0.1
[1a8c2f83] Query v1.0.0
[295af30f] Revise v3.1.16
[6038ab10] Rotations v1.0.2
[b3cc710f] StaticLint v4.5.0
[2913bbd2] StatsBase v0.33.8
[f3b207a7] StatsPlots v0.14.21
[cf896787] SymbolServer v5.1.1
[0c5d862f] Symbolics v0.1.25
[bd369af6] Tables v1.4.2
[5e47fb64] TestImages v1.5.0
[112f6efa] VegaLite v2.6.0
[fdbf4ff8] XLSX v0.7.6
[a4e569a6] Tar
I am seeing the same error when trying to save as .eps
julia> Pkg.status(["FileIO", "VegaLite", "ImageMagick"])
Status `C:\Users\HD\.julia\environments\v1.6\Project.toml`
[5789e2e9] FileIO v1.10.1
[6218d12a] ImageMagick v1.2.1
[112f6efa] VegaLite v2.6.0