How do you create a transparent .png using Images.jl?

The following does not work. In Photoshop terms, it creates a .png with a (solid black) background layer instead of an ordinary layer, and background layers cannot have transparent pixels.

julia> using Images

julia> img = fill(RGBA(0,0,0,0), (10,20))
10×20 Array{RGBA{N0f8},2} with eltype RGBA{Normed{UInt8,8}}:
 RGBA{N0f8}(0.0,0.0,0.0,0.0)  RGBA{N0f8}(0.0,0.0,0.0,0.0)  …  RGBA{N0f8}(0.0,0.0,0.0,0.0)
 RGBA{N0f8}(0.0,0.0,0.0,0.0)  RGBA{N0f8}(0.0,0.0,0.0,0.0)     RGBA{N0f8}(0.0,0.0,0.0,0.0)
 RGBA{N0f8}(0.0,0.0,0.0,0.0)  RGBA{N0f8}(0.0,0.0,0.0,0.0)     RGBA{N0f8}(0.0,0.0,0.0,0.0)
 RGBA{N0f8}(0.0,0.0,0.0,0.0)  RGBA{N0f8}(0.0,0.0,0.0,0.0)     RGBA{N0f8}(0.0,0.0,0.0,0.0)
 RGBA{N0f8}(0.0,0.0,0.0,0.0)  RGBA{N0f8}(0.0,0.0,0.0,0.0)     RGBA{N0f8}(0.0,0.0,0.0,0.0)
 RGBA{N0f8}(0.0,0.0,0.0,0.0)  RGBA{N0f8}(0.0,0.0,0.0,0.0)  …  RGBA{N0f8}(0.0,0.0,0.0,0.0)
 RGBA{N0f8}(0.0,0.0,0.0,0.0)  RGBA{N0f8}(0.0,0.0,0.0,0.0)     RGBA{N0f8}(0.0,0.0,0.0,0.0)
 RGBA{N0f8}(0.0,0.0,0.0,0.0)  RGBA{N0f8}(0.0,0.0,0.0,0.0)     RGBA{N0f8}(0.0,0.0,0.0,0.0)
 RGBA{N0f8}(0.0,0.0,0.0,0.0)  RGBA{N0f8}(0.0,0.0,0.0,0.0)     RGBA{N0f8}(0.0,0.0,0.0,0.0)
 RGBA{N0f8}(0.0,0.0,0.0,0.0)  RGBA{N0f8}(0.0,0.0,0.0,0.0)     RGBA{N0f8}(0.0,0.0,0.0,0.0)

julia> save("transparent.png", img)

julia> 

transparent

Problem … solved? It turns out the layer type depends on which fill color I use, even though the alpha channel is always zero:

transparent black RGBA(0,0,0,0) => background layer (no transparency)
transparent white RGBA(1,1,1,0) => ordinary layer (transparent)
transparent mid gray RGBA(.5,.5,.5,0) => background layer (no transparency)
transparent light gray RGBA(.9,.9,.9,0) => background layer (no transparency)
transparent dark gray RGBA(.1,.1,.1,0) => background layer (no transparency)
transparent any other color RGBA(.8,.2,.1,0) => index layer (transparent)

So transparency works if I fill with white or any other non-grayscale color. I’d like to open an issue for this inconsistency, but I’m not sure if I should open it in Images.jl, ImageMagick.jl (the underlying library on Windows) or FileIO.jl. Suggestions?

img = fill(RGBA(0,0,0,0.5), (200,200));
save("/tmp/transparent.png", img)

This creates a semitransparent grey box for me. (I’m on macOS.)

If the data appears to be correct in Julia, but wrong in the generated .png, that would seem to be a problem in ImageMagick.jl’s domain, so I’d start there. The fact that it seems to work on MacOS (which AFAIK uses QuartzImageIO instead of ImageMagick) also points in that direction.