Thanks Jacob and everyone for your help.  Perhaps I should describe more in detail 
what I'm doing.  I appreciate everyone's suggestions.

Petersen-Arne is a distributor of arts and craft supplies.  We stock over 40,000 SKUs. 
 We have been taking pictures of our products.  The process I worked out involved 
taking pictures (master) at 1024x768, and creating two thumbnail images 360x270 and 
160x120.  This worked fine, however those processing the images added to the process, 
not realizing they were creating images with different specifications.

I have 16,500 master images (1024x768), and the same amount for each of the thumbnail 
sizes.  >8600 of the master images are sized improperly (>52%).  I used the gimp 
script I wrote to test the sizes of the masters.  However I think I'll use Jacob's 
script to test the sizes of the thumbnails.

Here's what I have to do:
1) test width/height of thumbnails
solution: run jacob's script

2) visually audit the thumbnails
solution:  
I'm thinking what I would like ideally is a script that could open a graphic then wait 
for one of several keys.  Left/right arrows would slide-show through the array of 
filenames.  up/down arrows would switch between the various sizes 
(thumbnail/thumb2/master/original) of the same pic.  Space would print the filename to 
the console (to be redirected to a file).  Esc would quit.
  
So I can put it together, but the things I need are:
Is there a module that I can use to load a graphic (the gimp won't work for this)?
Once such an image is loaded, will the perl script still be listening on the keyboard?
If I load the image into something like xv or the gimp, then those programs will be 
monitoring the keyboard.
What are there functions to read the special and input keys?

3) resize the thumbnails from 360x270 to 320x240 and to 32x24
solution: scripts and programs already suggested 

4) rename all 49,500 images from a Pmdd####.jpg where m=[1-9abc] to 
cyyyy-mmdd-####.jpg  where c=[abc]  (c are categories where m is a month in hex and mm 
is a decimal month)
solution: perl script


I think that's everything.  So in addition to the questions above, here are some more:

So when I'm looking for base functionality, I should be looking through the man pages: 
man perl and derivatives; When looking for module functionality I should be searching 
cpan.org for keywords.  Is this how you perl scribes work?

For debian, should I mess with the debian cpan packages that was mentioned recently, 
or should I just have `perl -MCPAN -e shell`  install modules directly?  I like the 
idea of debian packages because I know how to remove them easily, and get a listing of 
those installed.

Thanks!
Cory


On Wed, May 16, 2001 at 02:11:45AM -0700, Jacob Meuser wrote:
> On Tue, May 15, 2001 at 11:37:33PM -0700, Jacob Meuser wrote:
> > On Tue, May 15, 2001 at 03:27:02PM -0700, Cory Petkovsek wrote:
> > > 
> > > No bob, it's not only the image size I want.  I have a bunch of images 
>improperly sized, and I need to know which one.  Next phase is to fix them.  Then 
>I'll be renaming a bunch of them (not using gimp, just perl), and I'll be resizing a 
>whole lot of them.  I'm working on about 48,000+ images!  Yikes!
> > > 
> > > > Image::Size is available from CPAN or in the libimage-size-perl package.
> > > >
> > 
> > Imager can do lots of kewl things ...
> > 
> >  
> > #! /usr/bin/perl -w
> > 
> 
> Well I got bored and actually ran that through the debugger ...
> 
> Much cleaner now :)
> 
> <[EMAIL PROTECTED]>
> 
> #!/usr/bin/perl -w
> 
> use Imager;
> use File::Copy;
> use strict;
> 
> my $old_dir = shift || '.';
> my $new_dir = "/home/cory/item";
> 
> opendir (DIR, $old_dir) or die "Can't open directory $old_dir: $!\n";
> my @files = grep (/[pP].+\.jpg/, readdir(DIR));
> closedir (DIR);
> 
> foreach (@files) {
>     my $old_file = "$old_dir/$_";
>     my $new_file = "$new_dir/$_";
>     my $img = Imager->new ();
>     $img->open (file=>"$old_file", type=>'jpeg')
>       or warn "failed: ", $img->{ERRSTR}, "\n";
>     my $width = $img->getwidth ();
>     my $height = $img->getheight ();
>     if (($width != 1024) || ($height != 768)){        
>       print "$_: $width" . "x" . "$height\n";
>       my $scaled = $img->scale(xpixels=>1024, ypixels=>768, 'min');
>       $scaled->write (file=>"$new_file", type=>'jpeg') 
>           or warn "failed: ", $scaled->{ERRSTR}, "\n";
>     } else {
>       copy ($old_file, $new_file);
>     }
> }
> 
> exit (0);

Reply via email to