[plt-scheme] image manipulation library?

From: Robert Wills (wrwills at gmail.com)
Date: Thu Jan 19 09:16:02 EST 2006

On Thu, 2006-01-19 at 14:53 +0100, Rohan Nicholls wrote:
>  Is there a library for
> manipulating images (pretty basic stuff, mostly resizing jpgs and maybe
> converting them to png format)?
> I know that Dr. Scheme has native support for images, but that seems to
> be a different thing.  I can always call out image magick through the
> shell (I guess I could use the ffi to use the library directly, but
> time is limited and I have other things to learn before the ffi).
Are you saying that you have other things to do before creating a whole
new ffi.  Or am I misunderstanding something?  If the former, then
there's an existing ImageMagick library in the distribution (magick.ss).
I've used it for resizing images as in the procedure below (I'm still
fairly new to scheme so I'm sure there are better ways of going about

;; create a thumbnail of desiredHeight from filename
(define make_thumb
  (lambda (filename desiredHeight)
    (let* ((i (MagickReadImage filename))
           (h (MagickGetImageHeight i))
           (w (MagickGetImageWidth i))
           (resizeTimes (/ desiredHeight h))
           (newname (newFilename filename desiredHeight))
      (MagickResizeImage i (round (* resizeTimes w)) desiredHeight
'UndefinedFilter 1.0)
      (MagickWriteImage i newname)

Apologies if I've misunderstood and you already know about this.


Posted on the users mailing list.