REBOL 3 Docs Guide Concepts Functions Datatypes Errors
  TOC < Back Next >   Updated: 3-Aug-2010 Edit History  

REBOL 3 Functions: to-image

to-image  value

Converts to image! value.

Arguments:

value

See also:

to  

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
write


  TOC < Back Next > REBOL.com - WIP Wiki Feedback Admin