REBOL Document

To-image - Function Summary




to-image value


value - The value argument.


This is a special conversion function that is used for converting a FACE object (such as those created by the layout function) into an image bitmap in memory.

For example, the code below converts the OUT layout to a bitmap image, then writes it out as a PNG file:

    out: layout [
        h2 "Title"
        button "Done"
    image: to-image out
    save/png %test-image.png image

This function provides a useful way to save REBOL generated images for use in other programs or web pages (which also allows you to print the images). For example, you can display the image above in a web browser with this code:

    write %test-page.html trim/auto {
        <IMG SRC="test-image.png">
    browse %test-page.html


to - Constructs and returns a new value after conversion.

<Back | Index | Next>

Copyright 2004 REBOL Technologies