[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Rounding errors in image size when printing to png/jpg etc.
From: |
amir |
Subject: |
Rounding errors in image size when printing to png/jpg etc. |
Date: |
Sun, 18 Sep 2011 06:18:57 -0700 (PDT) |
I see some sort of rounding error when saving to png or jpg.
The size of the image is very often slightly off by 1 or 2 pixels on the y-
or x-axis.
When using fltk, the code needs to be invoked twice to start scaling.
I hope that the scaling algorithm does not take into acount the dpi settings
(a pixel is a pixel, and if I say 480 pixel wide image, I mean a 480 pixel
wide image).
Just guessing, though.
Thanks
Amir
----------------------------------------------
graphics_toolkit ("fltk");
plot( linspace ( 0,1,11));
print('a.png','-dpng','-S4800,3200');
print('b.png','-dpng','-S2400,1600');
print('c.png','-dpng','-S480,320');
print('d.png','-dpng','-S481,321');
print('e.png','-dpng','-S482,322');
Result, 1st run:
a.png 1333,917
b.png 2400,1600
c.png 479,319
d.png 479,321
e.png 481,321
Result, 2nd run:
a.png 4800,3200
b.png 2400,1600
c.png 479,319
d.png 479,321
e.png 481,321
- - - - - - - - -
Restart octave
graphics_toolkit ("gnuplot");
plot( linspace ( 0,1,11));
print('a.png','-dpng','-S4800,3198');
print('b.png','-dpng','-S2400,1600');
print('c.png','-dpng','-S480,320');
print('d.png','-dpng','-S481,321');
print('e.png','-dpng','-S482,322');
Result, 1st run:
a.png 4800,3198
b.png 2400,1600
c.png 479,319
d.png 479,321
e.png 481,321
Result, 2nd run:
like first run.
--
View this message in context:
http://octave.1599824.n4.nabble.com/Rounding-errors-in-image-size-when-printing-to-png-jpg-etc-tp3821816p3821816.html
Sent from the Octave - General mailing list archive at Nabble.com.
- Rounding errors in image size when printing to png/jpg etc.,
amir <=