From bug-octave-request at bevo dot che dot wisc dot edu Wed May 30 09:21:51 2001 Subject: bug report and bug fix for saveimage.m From: Jean-Francois Cardoso To: bug-octave at bevo dot che dot wisc dot edu Date: Wed, 30 May 2001 09:21:45 -0500 Hello all, I have found a bug and a fix for it in `saveimage.m' (see description below). It is an annoying bug but the fix is trivial. As requested, I append a changelog entry and a patch. Thanks for octave. Cheers, JF. === Changelog entry ============================================== 2001-05-30 Jean-Francois Cardoso * m/image/saveimage.m: fix saving an image to Postscript format. === Bug report and explanation ===================================== Bug: saveimage does not properly save images in the postscript format. Version: still present in octave 2.1.34 Analysis: Pixels values are saved in hexa via fprintf calls but the format string is not correct: it does not prevent removing leading zeros so that the resulting stream badly confuses the Postscript intrepreter. Fix: Fix is trivial, essentially changing the format string from 'x' to '02x'. === Patch ========================================= *** saveimage.m Tue May 29 17:32:43 2001 --- saveimage.m~ Fri Jan 5 18:28:50 2001 *************** *** 292,296 **** img = map(img); ! fmt = "%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x\n"; fprintf (fid, fmt, img); --- 292,296 ---- img = map(img); ! fmt = "%x%x%x%x%x%x%x%x%x%x%x%x%x%x%x%x%x%x%x%x%x%x%x%x%x%x%x%x%x%x\n"; fprintf (fid, fmt, img); ------------------------------------------------------------- Octave is freely available under the terms of the GNU GPL. Octave's home on the web: http://www.octave.org How to fund new projects: http://www.octave.org/funding.html Subscription information: http://www.octave.org/archive.html -------------------------------------------------------------