This is epeg.egg.info, produced by makeinfo version 4.7 from
eggdoc-output.texi.

INFO-DIR-SECTION The Algorithmic Language Scheme
START-INFO-DIR-ENTRY
* epeg.egg: (epeg.egg).		Chicken bindings for the epeg thumbnailer library.
END-INFO-DIR-ENTRY


File: epeg.egg.info,  Node: Top,  Next: About this egg,  Up: (dir)

epeg egg
********

Chicken bindings for the epeg
(http://enlightenment.sourceforge.net/doxy/epeg/index.html) thumbnailer
library.

Written by Peter Bex (mailto:peter.bex@xs4all.nl)

   This manual corresponds to version 2.0 of the epeg extension library
for Chicken Scheme.

* Menu:

* About this egg::
* Documentation::
* Examples::
* License::
* Index::


File: epeg.egg.info,  Node: About this egg,  Next: Documentation,  Prev: Top,  Up: Top

1 About this egg
****************

* Menu:

* Version history::
* Requirements::
* Usage::


File: epeg.egg.info,  Node: Version history,  Next: Requirements,  Up: About this egg

1.1 Version history
===================

`2.0'
     Change API to use `epeg:' prefix for procedures.  Change to eggdoc
     documentation format.  Use GC finalizers.

`1.1'
     Added checks so (where it's possible) exceptions get thrown
     instead of segfaulting.

`1.0'
     initial release.


File: epeg.egg.info,  Node: Requirements,  Next: Usage,  Prev: Version history,  Up: About this egg

1.2 Requirements
================

This egg requires the following extensions:

   `syntax-case'


File: epeg.egg.info,  Node: Usage,  Prev: Requirements,  Up: About this egg

1.3 Usage
=========

Load this egg like so:

   `(require-extension epeg)'


File: epeg.egg.info,  Node: Documentation,  Next: Examples,  Prev: About this egg,  Up: Top

2 Documentation
***************

* Menu:

* General overview::
* Image creation destruction and friends::
* Image properties::
* Pixel query functions::


File: epeg.egg.info,  Node: General overview,  Next: Image creation destruction and friends,  Up: Documentation

2.1 General overview
====================

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.


File: epeg.egg.info,  Node: Image creation destruction and friends,  Next: Image properties,  Prev: General overview,  Up: Documentation

2.2 Image creation, destruction and friends
===========================================

 -- procedure: epeg:file-open
          (epeg:file-open filename)

     Returns a new `epeg:image' object which describes the image stored
     in the file `filename'.

 -- procedure: epeg:image?
          (epeg:image? img)

     Determine if the given `img' object is an epeg image.

 -- procedure: epeg:close
          (epeg:close img)

     Destroy the image and close the associated file.

 -- procedure: epeg:encode
          (epeg:encode img)

     Store the image to the file as determined by
     `epeg:file-output-set!'.  For other properties of the image, see
     below.


File: epeg.egg.info,  Node: Image properties,  Next: Pixel query functions,  Prev: Image creation destruction and friends,  Up: Documentation

2.3 Image properties
====================

 -- procedure: epeg:size-get
          (epeg:size-get img)

     Returns 2 values: the width and height of the _original_ image.

 -- procedure: epeg:file-output-set!
          (epeg:file-output-set! img filename)

     Set the output file for subsequent calls to `epeg:encode'.

 -- procedure: epeg:decode-size-set!
          (epeg:decode-size-set! img width height)

     Set the size of the new image, in pixels.  The original image is
     decoded into this size.

 -- procedure: epeg:decode-bounds-set!
          (epeg:decode-bounds-set! img x y width height)

     Set the bounds of the image to be decoded.  This is like cropping
     the image upon loading it.

 -- procedure: epeg:decode-colorspace-set!
          (epeg:decode-colorspace-set! img colorspace)

     Set the colorspace for decoding.  This is one of the following:

        * `epeg:colorspace-gray8'

        * `epeg:colorspace-yuv8'

        * `epeg:colorspace-rgb8'

        * `epeg:colorspace-bgr8'

        * `epeg:colorspace-rgba8'

        * `epeg:colorspace-bgra8'

        * `epeg:colorspace-argb32'

        * `epeg:colorspace-cmyk'


 -- procedure: epeg:colorspace-get
          (epeg:colorspace-get img)

     Returns the current colorspace value to use for decoding.The
     values returned by this is any of the constantsdescribed under
     `epeg:decode-colorspace-set!'.

 -- procedure: epeg:comment-set!
          (epeg:comment-set! img comment)

     Set the comment string for encoding.  By default, this is not
     written to the thumbnail! Use `epeg:thumbnail-comments-enable' to
     enable this.

 -- procedure: epeg:comment-get
          (epeg:comment-get img)

     Returns the comment string to use for encoding, or `#f' if none
     was set.

 -- procedure: epeg:thumbnail-comments-enable
          (epeg:thumbnail-comments-enable img)

     Enable comment field for the thumbnail.

 -- procedure: epeg:thumbnail-comments-enable
          (epeg:thumbnail-comments-enable img)

     Disable comment field for the thumbnail.  The default setting for
     comments is disabled.

 -- procedure: epeg:thumbnail-comments-get
          (epeg:thumbnail-comments-get img)

     Returns the uri field, width, height and mimetype of the thumbnail
     that will be written.

 -- procedure: epeg:quality-set!
          (epeg:quality-set! img percentage)

     Set the thumbnail's image quality (0 - 100).

 -- procedure: epeg:trim
          (epeg:trim img)

     Undocumented


File: epeg.egg.info,  Node: Pixel query functions,  Prev: Image properties,  Up: Documentation

2.4 Pixel query functions
=========================

Currently, the pixel query functions have been disabled.


File: epeg.egg.info,  Node: Examples,  Next: License,  Prev: Documentation,  Up: Top

3 Examples
**********


;;
;; 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)


File: epeg.egg.info,  Node: License,  Next: Index,  Prev: Examples,  Up: Top

4 License
*********


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.


File: epeg.egg.info,  Node: Index,  Prev: License,  Up: Top

Index
*****

 [index ]
* Menu:

* epeg:close:                            Image creation destruction and friends.
                                                               (line 18)
* epeg:colorspace-get:                   Image properties.     (line 51)
* epeg:comment-get:                      Image properties.     (line 65)
* epeg:comment-set!:                     Image properties.     (line 58)
* epeg:decode-bounds-set!:               Image properties.     (line 23)
* epeg:decode-colorspace-set!:           Image properties.     (line 29)
* epeg:decode-size-set!:                 Image properties.     (line 17)
* epeg:encode:                           Image creation destruction and friends.
                                                               (line 23)
* epeg:file-open:                        Image creation destruction and friends.
                                                               (line  7)
* epeg:file-output-set!:                 Image properties.     (line 12)
* epeg:image?:                           Image creation destruction and friends.
                                                               (line 13)
* epeg:quality-set!:                     Image properties.     (line 88)
* epeg:size-get:                         Image properties.     (line  7)
* epeg:thumbnail-comments-enable:        Image properties.     (line 71)
* epeg:thumbnail-comments-get:           Image properties.     (line 82)
* epeg:trim:                             Image properties.     (line 93)



Tag Table:
Node: Top248
Node: About this egg675
Node: Version history857
Node: Requirements1243
Node: Usage1444
Node: Documentation1599
Node: General overview1848
Node: Image creation destruction and friends2242
Node: Image properties3054
Node: Pixel query functions5707
Node: Examples5916
Node: License7136
Node: Index8734

End Tag Table
