JuliaImages / Images.jl

An image library for Julia
http://juliaimages.org/
Other
533 stars 141 forks source link

ERROR: LoadError: KeyError: RGBA not found #396

Closed yakir12 closed 8 years ago

yakir12 commented 8 years ago

Hi Tim! I get a KeyError warning and then an error when trying to save an RGBA image:

using Images
a = rand(10, 10, 4)
img = colorim(a, "RGBA")
save("a.png", img)

I tried this with both the tagged and checked-out versions of Images.jl. Here's the output:

WARNING: KeyError("RGBA")
 in setimagecolorspace at /home/yakir/.julia/v0.4/ImageMagick/src/libmagickwand.jl:309
 in constituteimage at /home/yakir/.julia/v0.4/ImageMagick/src/libmagickwand.jl:196
 in image2wand at /home/yakir/.julia/v0.4/ImageMagick/src/ImageMagick.jl:173
 in save_ at /home/yakir/.julia/v0.4/ImageMagick/src/ImageMagick.jl:146
 in save at /home/yakir/.julia/v0.4/ImageMagick/src/ImageMagick.jl:64
 in save at /home/yakir/.julia/v0.4/FileIO/src/loadsave.jl:92
 in save at /home/yakir/.julia/v0.4/FileIO/src/loadsave.jl:51
ERROR: KeyError: RGBA not found
 in setimagecolorspace at /home/yakir/.julia/v0.4/ImageMagick/src/libmagickwand.jl:309
 in constituteimage at /home/yakir/.julia/v0.4/ImageMagick/src/libmagickwand.jl:196
 in image2wand at /home/yakir/.julia/v0.4/ImageMagick/src/ImageMagick.jl:173
 in save_ at /home/yakir/.julia/v0.4/ImageMagick/src/ImageMagick.jl:146
 in save at /home/yakir/.julia/v0.4/ImageMagick/src/ImageMagick.jl:64
 in save at /home/yakir/.julia/v0.4/FileIO/src/loadsave.jl:92
 in save at /home/yakir/.julia/v0.4/FileIO/src/loadsave.jl:51
SimonDanisch commented 8 years ago

Yeah, there is no RGBA in https://github.com/JuliaIO/ImageMagick.jl/blob/master/src/libmagickwand.jl#L93:

const IMColorspace = ["RGB", "Gray", "Transparent", "OHTA", "Lab", "XYZ", "YCbCr", "YCC", "YIQ", "YPbPr", "YUV", "CMYK", "sRGB"]
const IMColordict = Dict([(IMColorspace[i], i) for i = 1:length(IMColorspace)])

Inserting it seems to solve this. @timholy, since this seems to be forgotten, are there also other formats missing? I'm not really sure what this dict represents ;)

timholy commented 8 years ago

Anything related to ImageMagick should now be reported in the new ImageMagick package. Fixed in https://github.com/JuliaIO/ImageMagick.jl/pull/16

timholy commented 8 years ago

I'm not really sure what this dict represents ;)

The "lovely" :wink: ImageMagick documentation and source code docs make it clearer.