Not bad in GMT
using GMT
@time gmtwrite("test.png", mat2img(rand(UInt8, 20_000, 20_000)))
21.020054 seconds (139 allocations: 763.254 MiB, 0.23% gc time)
@time gmtwrite("test.png", mat2img(rand(UInt8, 20_000, 20_000, 3)))
64.790045 seconds (139 allocations: 2.235 GiB, 0.12% gc time)
# test.png size ~1.11 GB