TO-IMAGE

REBOL Dictionary 2.0


Summary:

Converts to image value.

Usage:

to-image value

Arguments:

value - Value to convert

Description:

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"
        field
        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 {
        <HTML><BODY>
        <H2>Image:</H2>
        <IMG SRC="test-image.png">
        </BODY></HTML>
    }
    browse %test-page.html

Related:

to - Constructs and returns a new value after conversion.


<Back | Index | Next>

Copyright 2003 REBOL Technologies