Hi,for those using the FUM utilities, a script for importing
a BITMAP file ( must be "plain", i.e. RGB encoded not RLE encoded;
use PaintShop for conversion and information ) into a new matrix, follows.
START:
////////////// import bitmap into a matrix /////////////////;
getfilename -m *.bmp;
getfilename -g 1;%S=%A;type -q %S;
getnumber (nr_cols) nr_cols (nr_rows) nr_rows (MUST SPECIFY DIMENSION OF
BITMAP);
win -T Matrix;win -r %H %S;%D=%H;
size_bitmap=nr_cols*nr_rows;
nn=file.exists(%S);type -q $(nn);
hfile=file.open(%S,2); type -q $(hfile);
pos_curr=file.getpos(hfile); type -q "curr=$(pos_curr)";
size_file=file.size(hfile); type -q "file_size=$(size_file)";
pos_begin=size_file-size_bitmap;
file.setpos(pos_begin,hfile); type -q "pos_begin=$(pos_begin)";
pos_curr=file.getpos(hfile); type -q "curr=$(pos_curr)";
matrix -ps dim nr_cols nr_rows;
file.aread(%D,1,size_bitmap,0,hfile);
res_close=file.close(hfile);type -q "res_close: $(res_close)";
////////////// import bitmap into a matrix /////////////////;
END.
Known bug (btw, is there a predefined maximum size for a string
variable in Origin ?) : seems to fail if the full-path name of the file
(i.e. C:\..\...\***.bmp) is too long.
Hope it'll be of some use.
cristian b. stagarescu
crissteg@buphy.bu.edu