Gray is part of Images
julia> using Images
julia> @time save("test.png", rand(Gray, 20, 20))
2.869541 seconds (1.63 M allocations: 94.804 MiB, 5.60% gc time, 85.79% compilation time)
julia> @time save("test.png", rand(Gray, 20, 20))
0.000943 seconds (29 allocations: 6.203 KiB)
julia> @time save("test.png", rand(Gray, 2_000, 2_000))
0.328472 seconds (32 allocations: 38.164 MiB, 18.80% gc time)
julia> @time save("test.png", rand(Gray, 10_000, 10_000))
10.394720 seconds (33 allocations: 953.753 MiB, 8.13% gc time)
julia> @time save("test.png", rand(Gray, 20_000, 20_000))
46.454625 seconds (33 allocations: 3.725 GiB, 0.32% gc time)
RGB
is also available
julia> @time save("test.png", rand(RGB, 20, 20))
1.728649 seconds (1.23 M allocations: 69.212 MiB, 89.54% compilation time)
julia> @time save("test.png", rand(RGB, 20, 20))
0.086617 seconds (29 allocations: 14.141 KiB)
julia> @time save("test.png", rand(RGB, 2_000, 2_000))
0.762473 seconds (32 allocations: 114.458 MiB)
julia> @time save("test.png", rand(RGB, 10_000, 10_000))
28.764319 seconds (33 allocations: 2.794 GiB, 2.18% gc time)
I couldn’t do 20_000 x 20_000 in RGB as the little 8GB PC I’m typing this on OOMs and kills Julia
julia> @time save("test.png", rand(RGB, 200, 200))
0.011166 seconds (32 allocations: 1.148 MiB)