[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Resizing images (Gimp???)
On Fri, 28 Jun 2002, Erich Schroeder wrote:
> Here is a perl script I use. I often have to deal with images created on
> other OSs, so it moves everything to lower case, gets rid of spaces in
That is, it moves extensions to lowercase (just jpegs)
> filenames using a separate shell script I'm not including, and then
uses
> the "convert" command (part of imagagemagick) to create thumbnails and
That should be "imagemagick", of course.
> what we call "publication size" images to be imbedded within web pages:
>
> #!/usr/bin/perl -w
>
> use File::Basename;
>
>
> @upcasefiles = <*.JPG>;
> foreach $upcasefile (@upcasefiles) {
> ($name,$dir,$ext) = fileparse($upcasefile,'\..*');
> print "...Renaming $upcasefile to $name.jpg\n";
> rename($upcasefile, "$name.jpg");
> }
>
> print "Replacing spaces in file names with \"_\" \n";
> $cmd = "/local/WWW/RiverWeb/bin/stripspace\n";
> `$cmd`;
>
> print "...unlinking old thumbnails\n";
> @tfiles = <*-t.jpg>;
> unlink(@tfiles);
> print "...unlinking old publishfiles\n";
> @pfiles = <*-p.jpg>;
> unlink(@pfiles);
>
> print "...creating new thumbnail files\n";
> @files = <./*.jpg>;
>
> foreach $file ( @files ) {
> # print "$file\n";
> ($name,$dir,$ext) = fileparse($file,'\..*');
> # print "name = $name, dir = $dir, ext = $ext \n";
>
> $cmd = "convert $name$ext -geometry 140x95 $name-t.jpg";
>
> print $cmd, "\n";
> `$cmd`;
> }
>
> print "...creating new publication files\n";
> foreach $file ( @files ) {
> # print "$file\n";
> ($name,$dir,$ext) = fileparse($file,'\..*');
> # print "name = $name, dir = $dir, ext = $ext \n";
>
> $cmd = "convert $name$ext -geometry 300x250 $name-p.jpg";
>
> print $cmd, "\n";
> `$cmd`;
> }
>
>
>
>
--
---------------------------------------------------------------------
Erich Schroeder Phone: (217)785-0033
Curator, Information Technologies FAX: (217)785-2857
Illinois State Museum GIS Lab email:erich(at)illinois.state.museum
http://illinois.state.museum/
---------------------------------------------------------------------
-
To unsubscribe, send email to majordomo@silug.org with
"unsubscribe silug-discuss" in the body.