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
 All Forums
 Origin Forum
 Origin Forum
 FUM_script for importing a BITMAP into a new MATRIX

Note: You must be registered in order to post a reply.
To register, click here. Registration is FREE!

Screensize:
UserName:
Password:
Anti-Spam Code:
Format Mode:
Format: BoldItalicizedUnderlineStrikethrough Align LeftCenteredAlign Right Horizontal Rule Insert HyperlinkUpload FileInsert Image Insert CodeInsert QuoteInsert List
   
Message:

* HTML is OFF
* Forum Code is ON
Smilies
Smile [:)] Big Smile [:D] Cool [8D] Blush [:I]
Tongue [:P] Evil [):] Wink [;)] Clown [:o)]
Black Eye [B)] Eight Ball [8] Frown [:(] Shy [8)]
Shocked [:0] Angry [:(!] Dead [xx(] Sleepy [|)]
Kisses [:X] Approve [^] Disapprove [V] Question [?]

 
Check here to subscribe to this topic.
   

T O P I C    R E V I E W
a_user Posted - 08/14/1998 : 7:40:00 PM
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


The Origin Forum © 2020 Originlab Corporation Go To Top Of Page
Snitz Forums 2000