0

I have a simple question about using GR.jl directly (Not using Plots.jl).
I am displaying an image of size 300x300.

I want to display it on screen and save the plot with savefig:

using GR

img = rand(300, 300)

imshow(img)

savefig("img.png")

I expect the output to have size of 300x300 yet I get much bigger size.

How can I control the output size?

I saw https://github.com/JuliaPlots/Plots.jl/issues/2303 yet I am not sure if it is related.

Mark
  • 175
  • 1
  • 6

1 Answers1

1

savefig("img.png", height = 300, width = 300) should produce the correct size PNG. For further modifications you can use the functions in the Images package on your img prior to writing to file.

Bill
  • 5,600
  • 15
  • 27