Documention for: oneliner-image-to-ppm.r Created by: vincentecuye on: 29-Jan-2013 Last updated by: vincentecuye on: 29-Jan-2013 Format: text/editable Downloaded on: 30-Apr-2025 oneliner-image-to-ppm.r Author: Vincent Ecuyer Date: 30-Jan-2013 ===Purpose Short code to save an image! as a color image in PPM binary (P6) format. It's mostly useful for interacting with the Netpbm tools. No alpha information is saved, use 'alpha-to-pgm too (in one-liner-image-to-pgm.r) if you need it. ===Usage to-ppm value (image!) ===Example REBOL 2: write/binary %imageTest.ppm to-ppm make image! [320x256 255.0.0] REBOL3 always write in binary, so: write %imageTest.ppm to-ppm make image! [320x256 255.0.0] ===Commented Code to-ppm: func [ "Converts an image to a PPM binary file format" value [image!] "Image source" ] [ ; equivalent to "to-binary rejoin" : we want a binary! resul join #{} [ ; the binary PPM file header, followed by a "P6 " ; the image size, in the form width height replace form value/size "x" " " ; a , the max component value, and a " 255^(0A)" : the image data as RGB bytes sequences value/rgb ] ]