Dean Hamstead wrote:

> Im after some java classes that will resize images quickly
> and should ideally be (l)gpl or bsd licensed. Jpg is the
> main format im after resizing, but the more the merrier.
> 
> This will save us quite a bit of development time.
> 
> We are building a database of images, upon entering the
> image, we would like to have a thumbnail automagically
> created and inserted along size the full size image.

I have the same requirement. I'm a little embarrassed to admit that I
did it with the following GIMP script:

(define
        (thumbnail filename tfilename)

        (let
                (
                (image (car (file-jpeg-load 0 filename filename)))
                )

                (let
                        (
                        (width (car (gimp-image-width image)))
                        (height (car (gimp-image-height image)))
                        )

                        (let
                                (
                                (scale (sqrt (/ 19200 (* width
height))))
                                )

                                (gimp-image-scale image (* width scale)
(* height scale))
                                (file-jpeg-save 1 image 2 tfilename
tfilename 1 0 1)
                        )
                )
        )
)

Where 19200 is the number of pixels in the thumbnail, regardless of the
actual size or aspect ratio of the original. This could have been made a
parameter, now that I think about it.

If you find Java code to do the same, I'd be most interested to hear.

- Raz


--
SLUG - Sydney Linux User Group Mailing List - http://slug.org.au/
More Info: http://slug.org.au/lists/listinfo/slug

Reply via email to