[epeg] is a super-fast library for resizing JPEGs. It offers an improvement of at least an order of magnitude over other known libraries like '''ImageMagick'''. Here are some numbers indicative of its speed: $ time ./tclepeg test.jpeg test.jpg real 0m0.063s user 0m0.060s sys 0m0.000s $ time convert -resize 426x640 test.jpeg test.jpg real 0m1.158s user 0m1.048s sys 0m0.052s In the above example the improvement is 18 fold. ''test.jpeg'' is a 2592x3888 image that is resized to a 426x640 one using the [epeg] library. '''Convert''' is ImageMagick's convert utility. It took ''epeg'' 63 msec to do the conversion against 1158 msec for ImageMagick. These timings include reading/writing to disk. '''tclepeg''' takes about 1msec to do the conversion on the same system. [tclepeg] is a first effort to bring '''epeg''''s functionality to TCL by means of a binary linux library that can be [load]ed into a TCL program. Size options are not yet parsed and the quality value is fixed, but this initial C code is posted here with the hope that more competent tclers may step in to improve it. ---- **C code for the tclepeg library** The library provides a TCL command ''epeg'' that takes as an argument JPEG image data. In the code below the output is fixed to 320x240px, 75% JPEG quality. See [epeg] for more. Compiles on an Ubuntu Linux machine. /* * tclepeg.c -- A fast JPEG resize (reduction) Tcl C extension based on the epeg library * For a source repository of epeg look in : * http://maemo.gitorious.org/maemo-af/epeg * http://svn.enlightenment.org/svn/e/OLD/epeg/ * * Adapted to tcl by dzach * */ #include #include #include #include "Epeg.h" static int Tclepeg_Cmd(ClientData cdata, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]) { if(objc < 2) { Tcl_SetObjResult(interp, Tcl_NewStringObj("wrong # args. Should be epeg ?option value ...? jpegdata", -1)); return TCL_ERROR; } int i, w=320, h=240, q=50, sizei, sizeo; unsigned char *imi, *imo, *opt, *val; Epeg_Image *im; // set user options for (i=1; i>Image Processing