changeset 180:ea610bd930f6

Fix newly broken indexed 256 color bmp
author pkienzle
date Mon, 20 Mar 2006 03:11:05 +0000
parents b4f5a702f92c
children 86245dc12239
files bmpwrite.m
diffstat 1 files changed, 2 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/bmpwrite.m
+++ b/bmpwrite.m
@@ -55,7 +55,7 @@
     [h,w] = size(x);
     padw = ceil(w/4)*4-w;
     header = 14+40+4*rows(map);
-    filesize = header+(r+padw)*c;
+    filesize = header+(w+padw)*h;
     arch = "ieee-le";
     file = fopen(file, "wb");
     fwrite(file,toascii("BM"),"uchar",0,arch); # file tag
@@ -83,6 +83,6 @@
 
     ## raster image, each line on a 32-bit boundary, padded with zeros
     ## lines written bottom to top.
-    fwrite(file,[flipud(x-1)',zeros(c,padw)],"uchar",0,arch);
+    fwrite(file,[flipud(x-1)';zeros(padw,h)],"uchar",0,arch);
     fclose(file);
 endfunction