Google
  Web www.spinics.net

Re: [Gimp-user] creating thumbnails from a script

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]


[  date  ] 2001/09/01 | Saturday | 01:30 PM
[ author ] John Beppu <beppu@binq.org> 

>     ...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.


 1 ; create a thumbnail
 2 (define (create-thumbnail filename)
 3   (let* 
 4       ((image     (car (gimp-file-load 0 filename filename)))
 5        (drawable  nil)
 6        (wd        (car (gimp-image-width image)))
 7        (hi        (car (gimp-image-height image)))
 8        (_wd       (* wd scale))
 9        (_hi       (* hi scale))
10        (new-filename nil))
11        
12     (gimp-image-scale image _wd _hi)
13     (set! drawable (car (gimp-image-flatten image)))
14     (script-fu-old-photo image drawable 1 0 1 1 0)
15     (set! drawable (car (gimp-image-flatten image)))
16     (set! new-filename (change-extension filename new-ext))
17     (gimp-file-save 1 (+ image 1) drawable new-filename new-filename)
18     (gimp-image-delete image)
19     ))


Check out line 17:

    (gimp-file-save 1 (+ image 1) drawable new-filename new-filename)
                      ^^^^^^^^^^^

    I noticed that script-fu-old-photo would create an IMAGE object
    with exactly the same filename as the one I was working on.
    Since all an IMAGE seems to be is an integer that serves as
    an internal reference, and since this integer is incremented
    every time a new IMAGE is instantiated...
    I thought to myself, "What if I try to save (+ image 1), instead?"

    Well, it worked.  Strangely, I was not able to do
    (gimp-image-delete (+ image 1)).  Somewhere along the line, the
    image referred to by (+ image 1) ceases to exist.  I don't know
    why or how or where.  It's a complete mystery to me.
    
    Some of you might think that it must be after the gimp-file-save,
    but it's more complicated than that.  I can comment out lines 17
    and 18, and only the original image (not (+ image 1)) will exist.
    Am I hallucinating?  WTF is going on?

    I'm tempted to post on gimp-developer, but I don't know if it's
    appropriate.  Suggestions, anyone?


-- 
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]

Add to Google amazon