The Royal Nick Humphrey Global World IT Forum, Home Edition  

Go Back   The Royal Nick Humphrey Global World IT Forum, Home Edition > Webutvikling Forum > Grafisk Design og Flash Forum > Gimp forum
FAQ Members List Calendar Search Today's Posts Mark Forums Read

Reply
 
Thread Tools Display Modes
  #1  
Old 02-06-09, 16:08
Nickleus's Avatar
Nickleus Nickleus is offline
Nick Humphrey - Admin
 
Join Date: 06 Apr 2004
Location: Noreg
Posts: 2,794
Send a message via MSN to Nickleus Send a message via Skype™ to Nickleus
Default how to batch crop images in gimp from the command line

i'm using gimp 2.6.6
make a file called:
~/.gimp-2.6/scripts/batch-crop.scm
give it these contents:
Code:
(define (batch-crop pattern width height xoffset yoffset)
        (let*   ((filelist (cadr (file-glob pattern 1))))
                (while (not (null? filelist))
                        (let* ( (filename (car filelist))
                                (image (car (gimp-file-load RUN-NONINTERACTIVE filename filename)))
                                (drawable (car (gimp-image-get-active-layer image)))
                              )
                                (gimp-image-crop image width height xoffset yoffset)
                                (gimp-file-save RUN-NONINTERACTIVE image drawable filename filename)
                                (gimp-image-delete image)
                        )
                        (set! filelist (cdr filelist))
                )
        )
)
say you have a couple of screenshots you want to crop, e.g., here:
Desktop/screenshots/1.png
Desktop/screenshots/2.png

open gnome-terminal and then cd to the folder where you have the images you want to batch crop, e.g.:
Code:
cd Desktop/screenshots/
then run the batch crop script like this:
Code:
gimp -i -b '(batch-crop "*.png" 1185 667 5 672)' -b '(gimp-quit 0)'
the 4 numerical parameters are width height x-offset y-offset

ref:
http://www.geocities.com/hildstrom/p...ipt/index.html
http://www.gimp.org/tutorials/Basic_Batch/
__________________
Nick Humphrey
Download for free my experimental music, art, poetry and pictures.
My album Classic E B-sides can be purchased on both itunes and amazon.com.
Help me improve my phrasebook of world languages.
I offer remote healing services.
My blog.
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
start stop kill outlook process program from dos command line bat or batch file Nickleus Windows Vista forum 0 18-01-08 10:23
linux bash - line 26: : command not found Nickleus Linux bash forum 0 14-08-07 14:09
how to backup a microsoft sql server (superoffice) database from the command line Nickleus SuperOffice forum 0 21-05-07 10:01
Linux bash - test.sh: line 3: FILENAME: command not found Nickleus Linux bash forum 0 10-04-06 10:43


All times are GMT +2. The time now is 10:57.


Powered by vBulletin® Version 3.6.7
Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.
Check out my phrasebook
All rights reserved 2004-2009