REBOL [
    Title: "Generate thumbnail"
    Purpose: {Helper function to generate a PNG thumbnail image
    from a specified JPG file.}
]

;; [---------------------------------------------------------------------------]
;; [ This is a helper function pulled out of a primitive image cataloging      ]
;; [ program.  Its purpose is to generate a file that is a thumbnail image     ]
;; [ of a given picture.  The caller supplies the name of the input image      ]
;; [ as well as the name of the thumbnail file since we wanted the generality  ]
;; [ of being able to call the thumbnail anything we wanted.                   ]
;; [ This way of generating the thumbnail might not be the best.               ]
;; [ We discovered this way by reading the documentatin from REBOL and Nick.   ]
;; [---------------------------------------------------------------------------]

GENERATE-THUMBNAIL: func [
    FILENAME-ORIGINAL
    FILENAME-THUMBNAIL
    /local TEMPIMAGE
] [
    layout [TEMPIMAGE: image 80x60 effect [aspect]]
    TEMPIMAGE/image: load FILENAME-ORIGINAL
    save/png FILENAME-THUMBNAIL to-image TEMPIMAGE
]