png size changed in 3.1.52

Ben Abbott bpabbott at mac.com
Mon Feb 23 17:06:37 CST 2009


On Feb 23, 2009, at 11:31 AM, Francesco Potorti` wrote:

>>> Is there a reason why the PNG default print size is forced to  
>>> 576x432
>>> in 3.1.52?
>>>
>>> Before 3.1.52, the default size was the "large" one of gnuplot,  
>>> which
>>> is a more common 640x480.
>>
>> I hope this will change soon. I'm working on a full support of the
>> figure properties "papersize" and "paperposition". I also hope to
>> allow the resolution (dpi) to be specified as well.
>>
>> My intention is to make the default consistent with Matlab.
>
> Thank you.  By a quick glance at the sources, I think I guess that the
> size is set by gnuplot_set_term in gnuplot_drawnow.m, and then "large"
> is set by print.m.
>
> Just removing the "size" setting would bring things back to the  
> default
> 640x480, but I do not know what would be the side effects for  
> terminals
> other than PNG.

The commands below would produce a 640x480 size in Matlab ...

	 set (gcf, "paperunits", "inches")
	 set (gcf, "papersize", [6.4, 4.8])
	 set (gcf, "paperposition", [0 0 6.4, 4.8])
	 print -dpng -r100 myfile.png

At the present time, the developers sources defaults to the resolution  
of your screen ... at least that's my understanding.

You could try

	 dpi = get (0, "screenpixelsperinch");
	 paper_size = round ([640, 480]./dpi);
	 set (gcf, "paperunits", "inches")
	 set (gcf, "papersize", paper_size)
	 set (gcf, "paperposition", [0, 0, paper_size])
	 print ("-dpng", sprintf("-r%d", dpi), "myfile.png")

This isn't working for me because, I'm half way though adding the  
compatible behavior.

Please let me know if it does for you.

Ben



More information about the Bug-octave mailing list