GimpTalk
http://gimptalk.com/forum/

script-fu batch resize
http://gimptalk.com/forum/viewtopic.php?f=9&t=9440
Page 1 of 1

Author:  redforce [ Sat Sep 16, 2006 8:31 pm ]
Post subject: 

I have made a Script-Fu to batch-resize images because I couldn't find one that only resizes images (only thumbnail gallerys etc.)

Just download and put to your scripts directory:

http://www.gimpusers.de/dl/batch-resize-2.2.scm (for GIMP 2.2)
http://www.gimpusers.de/dl/batch-resize-2.4.scm (for GIMP 2.4)

The script is German but it only has three parameters:
1) path to images, e.g. "/home/richard/tmp/*.jpg"
2) new width
3) new height

You can start the script from Xtns/Script-Fu/Verschiedenes/Mehrere Bilder verkleinern...

More images and detailled infos (text in German) are available at:
http://www.gimpusers.de/tutorials/script-fu-batch-resize.html

Author:  Kiko [ Sat Sep 16, 2006 8:39 pm ]
Post subject: 

cant you just scale the image?

Author:  redforce [ Sat Sep 16, 2006 8:41 pm ]
Post subject: 

I want to scale many images, e.g. the last holiday photos. This is why i need BATCH resize

Author:  PhotoComix [ Sat Sep 16, 2006 10:58 pm ]
Post subject: 

Quote:
the script is German but it only has three parameters:
1) path to images, e.g. "/home/richard/tmp/*.jpg"
2) new width
3) new height


4 parameters i hope: i would like choose a folder for the resized images...or it will overwrite the originals?

Author:  devvv [ Sat Sep 16, 2006 11:18 pm ]
Post subject: 

it is intended to overwrite the original files.

you can make a copy first and then resize the duplicates.

regards,

Author:  PhotoComix [ Sat Sep 16, 2006 11:25 pm ]
Post subject: 

Thank

Author:  Narkster [ Thu Dec 27, 2007 9:55 pm ]
Post subject: 

I tried to use this with no luck and had to deal with it for the holiday's and a silly little electronic photo frame.

The 2.4 script doesn't work out of the box so I am submitting the updaed version for 2.4.

[url]http://www.usaupload.net/d/nmet080o0k0[/url]

Author:  hello_earth [ Wed Mar 26, 2008 7:00 pm ]
Post subject: 

Thank you :) Nice scripts :)
I made my own modification - using single aspect ratio instead of width & height. Some things in code are most possible redundant (e.g. recalculating ratio) so somebody probably can correct this. Anyway :) Hope it's okay to put code in here - no time for safe uploading.

Put all this inside scripts directory (on my computer it's c:\program files\GIMP-2.0\share\gimp\2.0\scripts) in a text file called e.g. batch-scale-ratio.scm) and reload the scripts in GIMP menu->Xtns->Script-fu->Refresh scripts
so then you can see it under GIMP menu->Xtns->Misc

cheers!

Code:

(define (script-fu-batch-scale-ratio globexp ratio)
  (define (resize-img n f)
   (let* ((fname (car f))
          (img (car (gimp-file-load 1 fname fname))))
       (let* (
             (drawable   (car (gimp-image-active-drawable img)))
             (cur-width  (car (gimp-image-width img)))
             (cur-height (car (gimp-image-height img)))
          (new-width  (* ratio cur-width))
          (new-height (* ratio cur-height))
             (new_ratio      (min (/ new-width cur-width) (/ new-height cur-height)))
             (width      (* new_ratio cur-width))
             (height     (* new_ratio cur-height))
          )
    
         (gimp-image-undo-disable img)
         (gimp-image-scale img width height)
         (gimp-file-save 1 img (car (gimp-image-get-active-drawable img)) fname fname)
         (gimp-image-delete img)
      )
    )
    (if (= n 1) 1 (resize-img (- n 1) (cdr f)))
  )
  (let* ((files (file-glob globexp 0)))
     (resize-img (car files) (car (cdr files))))
)

(script-fu-register "script-fu-batch-scale-ratio"
          _"Batch Image Scale By Ratio"
          "Hey!"
          "Nicholas Herring and Richard Hirner (http://www.gimptalk.com/forum/topic/Script-fu-Batch-Resi-e-9440-1.html) & ADP (http://www.adp-gmbh.ch/misc/tools/script_fu/ex_10.html), hello_earth"
          "2008, Nicholas Herring based on a script by Richard Hirner"
          "March 26, 2008"
          ""
          SF-STRING "Full path with wildcards" "C:\\Test\\*.jpg"
          SF-VALUE "Scaling ratio (min 0.01, max 1)" "0.50")
(script-fu-menu-register "script-fu-batch-scale-ratio"
          "<Toolbox>/Xtns/Misc")


Author:  tatakae [ Wed Apr 23, 2008 8:47 am ]
Post subject: 

Quote:
Thank you :) Nice scripts :)
I made my own modification - using single aspect ratio instead of width & height. Some things in code are most possible redundant (e.g. recalculating ratio) so somebody probably can correct this. Anyway :) Hope it's okay to put code in here - no time for safe uploading.

Put all this inside scripts directory (on my computer it's c:\program files\GIMP-2.0\share\gimp\2.0\scripts) in a text file called e.g. batch-scale-ratio.scm) and reload the scripts in GIMP menu->Xtns->Script-fu->Refresh scripts
so then you can see it under GIMP menu->Xtns->Misc

cheers!


This is exactly what I have been looking for. Thank you for posting a scaling version!

Author:  fullygimped [ Mon Oct 13, 2008 7:36 pm ]
Post subject:  Re: script-fu batch resize

This is awesome - You rock !!

Author:  Tonio [ Thu Oct 23, 2008 11:30 am ]
Post subject:  Re: script-fu batch resize

Ok, so I tried to save that as what you said, into where you said etc. I have looked around, but I am really stupid by the looks of it.

All I wanted was a easy way to convert files from one size to another, pref. in a new folder.. with gimp 2.6... If anyone could help, please do...

Author:  jasshrie [ Sat Mar 20, 2010 12:15 pm ]
Post subject:  Re: script-fu batch resize

i was searching for the same thing for Gimp 2.6 and found this:

http://members.ozemail.com.au/~hodsond/dbp.html

works perfectly for me!

Good luck!

Page 1 of 1 All times are UTC
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
http://www.phpbb.com/