Chicken bindings for the epeg thumbnailer library.
epeg:
prefix for procedures. Change to eggdoc documentation format. Use GC finalizers.Epeg works by first opening a file, then setting the desired properties of the scaled image. Upon encoding, these properties are taken into account. Decoding is deferred until encoding of the new image takes place for optimal speed.
epeg:image
object which describes the image stored in the file filename
.img
object is an epeg image.epeg:file-output-set!
. For other properties of the image, see below.epeg:encode
.epeg:colorspace-gray8
epeg:colorspace-yuv8
epeg:colorspace-rgb8
epeg:colorspace-bgr8
epeg:colorspace-rgba8
epeg:colorspace-bgra8
epeg:colorspace-argb32
epeg:colorspace-cmyk
epeg:decode-colorspace-set!
.epeg:thumbnail-comments-enable
to enable this.#f
if none was set.Currently, the pixel query functions have been disabled.
;; ;; Almost literal translation of src/bin/epeg_main.c in the epeg distribution. ;; (use epeg) (unless (= (length (argv)) 3) (printf "Usage: ~A input.jpg thumb.jpg\n" (car (argv))) (exit 0)) ; This will throw an i/o file exception if the file can't be opened (define im (epeg:file-open (list-ref (argv) 1))) (let ((com (epeg:comment-get im))) (when com (printf "Comment: ~A\n" com))) (call-with-values (lambda () (epeg:thumbnail-comments-get im)) (lambda (uri width height mimetype) (when mimetype (printf "Thumb Mimetype: ~A\n" mimetype) (when uri (printf "Thumb URI: ~A\n" uri)) (printf "Thumb Mtime: \n") (printf "Thumb Width: ~A\n" width) (printf "Thumb Height: ~A\n" height)))) (call-with-values (lambda () (epeg:size-get im)) (lambda (width height) (printf "Image size: ~Ax~A\n" width height))) (epeg:decode-size-set! im 128 96) (epeg:quality-set! im 80) (epeg:thumbnail-comments-enable im) (epeg:comment-set! im "Smelly pants!") (epeg:file-output-set! im (list-ref (argv) 2)) (epeg:encode im) (epeg:close im) ; Not required (exit 0)
Copyright (c) 2004 - 2006, Peter Bex (peter.bex@xs4all.nl) All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. 3. Neither the name of Peter Bex nor the names of any contributors may be used to endorse or promote products derived from this software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY PETER BEX AND CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.