identify *image command built in to the operating system. Type man image for more info. image with a Perl script like the following example, to get the image filename, width and height into an XML file:#!/usr/bin/perl -w
use warnings;
use strict;
use Getopt::Long;
use File::Basename;
use IO::File;
use XML::Writer;
my ($inputDir, $outputDir, $imageSuffix);
my $optResults = GetOptions("inputDir=s" => \$inputDir, "outputDir=s" => \$outputDir, "imageSuffix=s" => \$imageSuffix)
# gallery XML options (cf. http://www.airtightinteractive.com/simpleviewer/options.html)
my $maxImageWidth = 960;
my $maxImageHeight = 640;
my $textColor = "0xFFFFFF";
my $frameColor = "0xFFFFFF";
my $frameWidth = "10";
my $stagePadding = "40";
my $navPadding = "40";
my $thumbnailColumns = "3";
my $thumbnailRows = "5";
my $navPosition = "left";
my $vAlign = "center";
my $hAlign = "center";
my $title = "$cellLine";
my $enableRightClickOpen = "true";
my $backgroundImagePath = "";
my $imagePath = "";
my $thumbPath = "";
my $galleryXMLOutput = new IO::File("> $outputDir/gallery.xml");
my $galleryXML = new XML::Writer(OUTPUT => $galleryXMLOutput, NEWLINES => 1, DATA_INDENT => 1);
$galleryXML->xmlDecl('UTF-8');
$galleryXML->startTag('simpleviewergallery', maxImageWidth=>$maxImageWidth, maxImageHeight=>$maxImageHeight, textColor=>$textColor, frameColor=>$frameColor, frameWidth=>$frameWidth, stagePadding=>$stagePadding, navPadding=>$navPadding, thumbnailColumns=>$thumbnailColumns, thumbnailRows=>$thumbnailRows, navPosition=>$navPosition, vAlign=>$vAlign, hAlign=>$hAlign, title=>$title, enableRightClickOpen=>$enableRightClickOpen, backgroundImagePath=>$backgroundImagePath, imagePath=>$imagePath, thumbPath=>$thumbPath);
open (LS, "ls $inputDir/*.$imageSuffix |") or die $?;
while (<LS>) {
chomp;
$_ =~ s/\r//;
my ($filename, undef, undef) = fileparse($_);
my $width = `image width $_`;
my $height = `image height $_`;
$galleryXML->dataElement('filename' => $fileName);
$galleryXML->dataElement('caption' => $_);
$galleryXML->dataElement('width' => $width);
$galleryXML->dataElement('height' => $height);
$galleryXML->endTag('image');
}
close (LS);
$galleryXML->endTag('simpleviewergallery');
$galleryXML->end();
$galleryXMLOutput->close();
# some other system() cmds to copy images, thumbnails and SimpleViewer resources to $outputDir
exit 0;makeGalleryXML.pl --inputDir=sourceImages --outputDir=myGallery --imageSuffix="png"gallery.xml file in the folder myGallery, listing PNG files and their attributes in the folder sourceImages.if (! -d $outputDir) { system ("mkdir -p $outputDir") == 0 or die $?; }my $galleryXMLOutput = new IO::File("> $outputDir/gallery.xml");image and just use the Spotlight database or Imagemagick.You are not logged in, either login or create an account to post comments
You'll still need to process that list to get it into exactly the form you want, but the information is there.
posted by hattifattener at 12:38 PM on April 3 [2 favorites]