[REBOL] Re: Embedding images (from newbie)
From: ljurado:bariloche:ar at: 8-Aug-2001 23:46
Ranald :
This is post to ALLY list from Carl Sassenrath:
Luis
-----------------------------------------------------------------------
Some types of scripts can benefit from embedded images. For instance, if you
want use nice arrows for next and back on buttons, such as a scroll bar.
Here's how:
1. Save your image as a REBOL binary:
system/options/binary-base: 64
save %image.r read/binary %image.gif
2. Paste image.r into your script, adding a load
to convert it into an image datatype.
image: load 64#{ ....
}
Optimizations:
1. Use compress on the image when you save it out.
save %image.r compress read/binary %image.gif
then the load becomes:
image: load decompress 64#{ ....
2. If you compress the BMP, it can be smaller than
compressing the GIF. (But, more research must
be done on this.)
3. If you don't need to use the image immediately,
don't decompress or load it. Just assign it to
a word or keep it in a list until you need to
display it.
4. You can reuse the SAME image multiple times.
For instance, an arrow pointing up can point
down if you do a VFLIP on it. Or, it can go
right and left with a ROTATE. This can save
many bytes.
-Carl