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

Re: GImp batch mode



TongKe Xue wrote:
Hi all,

  I want to use gimp to convert a bunch of files from one image format
to another.

"man gimp" returns nothing.

  "gimp --help" mentions the option "--batch <commands>" ... sounds
like I should be able to write some script -- can anyone offer
pointers / enlighten me on this?

Thanks,
--TongKe


You could use ImageMagick to do this job for you. To learn more about ImageMagick's use check out this tutorial:

http://www-106.ibm.com/developerworks/library/l-graf/

The command you need to convert formats has a tutorial at this url:

http://www-106.ibm.com/developerworks/library/l-graf/?ca=dnt-428#N101E0

For example here is a hacked together script that I use every now and then to rotate all the photos in directory -- be aware that it will replace the original images with the rotated ones! I should probably fix things to store the rotated images elsewhere :-(

Hope this helps,
Clint



#!/usr/bin/perl

# Name: rotateemall
# Author: Clint Harshaw
# Date Late Modified: 19 MAR 2004

# Rotate all jpg files in a directory

use strict;

print "\nEnter path: ";

my $dirname = <STDIN>;
chomp $dirname;

opendir(DIR, $dirname) or die "I'm afraid I can't open the directory named $dirname: $!";

while (defined(my $file = readdir(DIR))) {
    next unless $file =~ /^*.jpg$/;
    system "mogrify -rotate '90>' $file";
}


closedir(DIR);





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