The Origin Forum
File Exchange
Try Origin for Free
The Origin Forum
Home | Profile | Register | Active Topics | Members | Search | FAQ | Send File to Tech support
Username:
Password:
Save Password
Forgot your Password? | Admin Options

 All Forums
 Origin Forum
 Origin Forum
 FUM_script for importing a BITMAP into a new MATRIX
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic Lock Topic Edit Topic Delete Topic New Topic Reply to Topic

a_user

USA
0 Posts

Posted - 08/14/1998 :  7:40:00 PM  Show Profile  Edit Topic  Reply with Quote  View user's IP address  Delete Topic
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

  Previous Topic Topic Next Topic Lock Topic Edit Topic Delete Topic New Topic Reply to Topic
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
The Origin Forum © 2020 Originlab Corporation Go To Top Of Page
Snitz Forums 2000