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

REBOL 3 Functions: encode

encode  type  data  /options  opts

Encodes a datatype (e.g. image!) into a series of bytes.


type [word!] - Media type (jpeg, png, etc.)

data [image! binary! string!] - The data to encode



opts [block!] - Special encoding options

See also:

decode   load   enbase   debase  


Used to call codecs to encode datatypes into binary data (bytes).

Codecs are identified by words that symbolize their types. For example the word png is used to identify the PNG codec.

See the system/codecs for a list of loaded codecs. Codecs can be native (built-in), externally loaded, or even coded in REBOL.


The line:

save %photo.bmp image

Is roughly equivalent to:

data: encode 'bmp image
write %photo.bmp data

  TOC < Back Next > - WIP Wiki Feedback Admin