Re: [Gimp-user] creating thumbnails from a script | |
| [Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] | |
[ date ] 2001/08/28 | Tuesday | 11:05 PM
[ author ] Glen Lee Edwards <glen@fcwm.org>
> I've been given over 200 jpg images that need to be thumbnailed. Is
> there a way from gimp to do this from a script or from the command
> line?
Since this /is/ a mailing list about the Gimp, I thought I'd
post a scheme-based approach.
; you should write a script to generate this next line of scheme
; if you have a lot of files
(set! argv '("filename1" "filename2" "filename3")) ; and so forth
; set defaults
(set! scale 0.30)
(set! new-ext "png")
; change the extension of a filename
(define (change-extension filename new-ext)
(let*
((chunk nil)
(new-filename nil)
(old-ext nil))
(set! chunk (strbreakup filename "."))
(set! old-ext (car (last chunk)))
(set! new-filename
(unbreakupstr
(mapcar
(lambda (x)
(if (= 0 (strcmp x old-ext)) new-ext x))
chunk) ; end of mapcar
".") ; end of unbreakupstr
)
))
; create a thumbnail
(define (create-thumbnail filename)
(let*
((image (car (gimp-file-load 0 filename filename)))
(drawable nil)
(wd (car (gimp-image-width image)))
(hi (car (gimp-image-height image)))
(_wd (* wd scale))
(_hi (* hi scale))
(new-filename nil))
(gimp-image-scale image _wd _hi)
(set! drawable (car (gimp-image-flatten image)))
(set! new-filename (change-extension filename new-ext))
(gimp-file-save 1 image drawable new-filename new-filename)
(gimp-image-delete image)
))
; main
(for-each create-thumbnail argv)
; fun-fact: this is my first non-trivial scheme program, ever.
Now, *I* have a question.
After I scale the image down, I want to be able to
apply a function like script-fu-old-photo or script-fu-drop-shadow.
Nothing I do seems to work, though. ;_;
For script-fu-drop-shadow, I can't seem to get the parameters
right, so it doesn't even execute -- it's frustrating.
For script-fu-old-photo, it executes (most of the time), but when
I try to do gimp-file-save, I get the scaled image WITHOUT the
old-photo effect being applied to it. This happens regardless of
whether I tell it to work on a copy or not.
...wait... I have an idea for old-photo.... but still, I can't
even execute script-fu-drop-shadow, and it's pissing me off. If
anyone can fix the code above to apply a drop-shadow effect, I'd
be really thankful.
--
package wuv'apqvjgt;($_=join('',(*PgtnHcemgt))) # print map "beppu\@$_\n", qw(
=~ s/([HaP])(?!e)/ \U>$1/g;s/^.|:| (?=A)|>//g;y # cpan.org lbox.org binq.org
/c-z/a-u/;print"J$_\n";#$^%$^X@.^ <!-- japh --> # oss.lineo.com codepoet.org);
[Home] [GIMP Development] [Video For Linux] [Photo] [Yosemite News] [Yosemite Photos] [Yosemite Book Store] [gtk] [KDE] [Scanner] [Gimp's Home] [Gimp Docs] [Gimp on Windows] [Steve's Art] [Webcams] [Share Your Images] [Free Online Dating] [Script Fu]
![]() |
![]() |