Since you're not really using Perl to do anything but arrange the various *nix programs, why not use a shell script instead? It would be simpler, shorter, and wouldn't involve spawning an unnecessary interpreter.
#!/bin/bash
for image in *.{gif,bmp,jpg,wmf,jpeg,png}
do
size=`/usr/bin/identify $image`
...
[do whatever with "$size" here]
...
convert -geometry 800x600 $image ${image/./-l.}
convert -geometry 80x60 $image ${image/./-s.}
done
...and so on. This may be just a personal quirk of mine, but I find shell scripts (or batch files) coerced into another language (whatever it happens to be) gratingly pointless.
Update: Incidentally, it fails in Linux.
ben@Tyr:/tmp/Sorayama$ ../thumbnail
hajime1.jpg
hajime10.jpg
hajime2.jpg
hajime3.jpg
hajime4.jpg
hajime5.jpg
hajime6.jpg
hajime7.jpg
hajime8.jpgconverting hajime1.jpg ...
convert: invalid argument for option `hajime1-l.jpgxhajime1.jpg!': -re
+size.
convert: invalid argument for option `hajime1-s.jpgxhajime1.jpg!': -re
+size.
converting hajime10.jpg ...
converting hajime2.jpg ...
convert: invalid argument for option `hajime2-l.jpgxhajime2.jpg!': -re
+size.
convert: invalid argument for option `hajime2-s.jpgxhajime2.jpg!': -re
+size.
converting hajime3.jpg ...
convert: invalid argument for option `hajime3-l.jpgxhajime3.jpg!': -re
+size.
convert: invalid argument for option `hajime3-s.jpgxhajime3.jpg!': -re
+size.
converting hajime4.jpg ...
convert: invalid argument for option `hajime4-l.jpgxhajime4.jpg!': -re
+size.
convert: invalid argument for option `hajime4-s.jpgxhajime4.jpg!': -re
+size.
converting hajime5.jpg ...
convert: invalid argument for option `hajime5-l.jpgxhajime5.jpg!': -re
+size.
convert: invalid argument for option `hajime5-s.jpgxhajime5.jpg!': -re
+size.
converting hajime6.jpg ...
convert: invalid argument for option `hajime6-l.jpgxhajime6.jpg!': -re
+size.
convert: invalid argument for option `hajime6-s.jpgxhajime6.jpg!': -re
+size.
converting hajime7.jpg ...
converting hajime8.jpg ...
convert: invalid argument for option `hajime8-l.jpgxhajime8.jpg!': -re
+size.
convert: invalid argument for option `hajime8-s.jpgxhajime8.jpg!': -re
+size.
--
Human history becomes more and more a race between education and catastrophe. -- HG Wells
-
Are you posting in the right place? Check out Where do I post X? to know for sure.
-
Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
<code> <a> <b> <big>
<blockquote> <br /> <dd>
<dl> <dt> <em> <font>
<h1> <h2> <h3> <h4>
<h5> <h6> <hr /> <i>
<li> <nbsp> <ol> <p>
<small> <strike> <strong>
<sub> <sup> <table>
<td> <th> <tr> <tt>
<u> <ul>
-
Snippets of code should be wrapped in
<code> tags not
<pre> tags. In fact, <pre>
tags should generally be avoided. If they must
be used, extreme care should be
taken to ensure that their contents do not
have long lines (<70 chars), in order to prevent
horizontal scrolling (and possible janitor
intervention).
-
Want more info? How to link
or How to display code and escape characters
are good places to start.