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.



See also:



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

  TOC < Back Next > - WIP Wiki Feedback Admin