Can you post a complete example? For example,
julia> using FileIO
julia> save("/tmp/test.png", rand(5,6))
Just Works for me. (I can open it in another program and see a small random
checkerboard pattern.)
Also,
julia> using Images, Colors
julia> mapi = MapNone{U8}()
Images.MapNone{FixedPointNumbers.UFixed{UInt8,8}}()
julia> map(mapi, 0.6592312388568704)
UFixed8(0.659)
also works.
Is one of your packages out-of-date? Check the output of Pkg.status().
Best,
--Tim
On Sunday, May 01, 2016 12:28:06 PM [email protected] wrote:
> Tim,
>
> I understand that values must fall within [0,1].
> However, rand only produces values that fall within that interval.
>
> For some reason, the package does not seem to find that true.
> Looking at the error message, it says:
> MethodError(Images.MapNone{FixedPointNumbers.UFixed{UInt8,8}}(),(0.659231238
> 8568704,))
>
> It thinks that 0.6592312388568704 is out-of-range or it cannot convert to
> UInt8.
> Regardless, I cannot pass UInt8 or Float64 arrays without receiving an
> error message.
>
> Something is wrong here.
>
> On Friday, April 29, 2016 at 4:19:16 AM UTC+3, Tim Holy wrote:
> > The key line in the error message is "out-of-range values": if you're
> > using
> > `Float64`, black corresponds to 0.0 and white corresponds to 1.0. It's
> > alerting you that some of your values went outside that range. If it
> > didn't
> > alert you to this problem in some way, then you'd wonder "how come I had
> > this
> > nice image but when I saved it and loaded the file, it was all white?" (or
> > all
> > black?)
> >
> > If you read the message carefully, it's also telling you how to avoid this
> >
> > problem:
> > map(Images.Clamp01NaN(img), img)
> >
> > where `img` is your array. This function will clamp all values to between
> > 0
> > and 1, even if your image contains NaN values.
> >
> > Best,
> > --Tim
> >
> > On Thursday, April 28, 2016 09:46:27 AM [email protected]
> >
> > <javascript:> wrote:
> > > Hello all,
> > >
> > > I'm trying to save PNG images of the mandelbrot set.
> > > So, I've been using the package Images to do so.
> > >
> > > To get a grip around how the package works, I've decided to test out the
> > > function "save".
> > > I've given it a filename to save in and a random two-dimensional array
> >
> > of
> >
> > > Float64s (Array{Float64, 2})
> > > However, it did not work.
> > >
> > > I keep getting the following error:
> > > WARNING: Mapping to the storage type failed; perhaps your data had
> > > out-of-range values?
> > > Try `map(Images.Clamp01NaN(img), img)` to clamp values to a valid range.
> >
> > > WARNING:
> > MethodError(Images.MapNone{FixedPointNumbers.UFixed{UInt8,8}}(),(0.6592312
> > 38>
> > > 8568704,)) [inlined code] from .\number.jl:54
> > >
> > > I don't really understand why this is happening.
> > > I'm currently using Julia 0.5.0-dev+3731.
> > > I've tried doing it in Julia 0.4.5, but it still doesn't work.
> > >
> > > Is this issue common? Or is it just on my machine?
> > > Regardless, what do I need to do to get this issue resolved?
> > >
> > >
> > > Thank you,
> > > Yousef