Graphics tricks from the Linux command line (IBM developerWorks)
The command line tools discussed in this article are part of the excellent ImageMagick suite, which ships with Red Hat Linux and is freely available online. ImageMagick can also be accessed via C, C++, Perl, Python, Java, and several other languages, which Linux programmers will appreciate."
Posted Jul 19, 2003 9:12 UTC (Sat)
by sholden (guest, #7881)
[Link] (8 responses)
Posted Jul 19, 2003 17:37 UTC (Sat)
by piman (guest, #8957)
[Link] (1 responses)
Posted Jul 20, 2003 2:03 UTC (Sun)
by sholden (guest, #7881)
[Link]
Posted Jul 20, 2003 22:17 UTC (Sun)
by mikal (guest, #8473)
[Link] (4 responses)
Posted Jul 21, 2003 1:27 UTC (Mon)
by orabidoo (guest, #6639)
[Link] (2 responses)
for i in *.jpg; do; whateveryouwant; done No need for ls or find. Long live shell globbing :)
Posted Jul 21, 2003 13:42 UTC (Mon)
by Peter (guest, #1127)
[Link] (1 responses)
Eh, be careful when pointing out eye motes. One of those semicolons doesn't belong. (Which semicolon? An exercise for the reader.)
Posted Jul 21, 2003 18:05 UTC (Mon)
by flewellyn (subscriber, #5047)
[Link]
Posted Jul 22, 2003 11:38 UTC (Tue)
by Dom2 (guest, #458)
[Link]
That's not more correct; you should be using xargs(1). :-)
The usual caveat about filenames with spaces in them requiring this instead: -Dom
Posted Jul 25, 2003 3:42 UTC (Fri)
by bignose (subscriber, #40)
[Link]
Hah. You think *you've* got pet hates. I look at the above and think "yech, they're still using backquotes when $() is POSIX-compliant and clearer". I then have time left over to think "... and they're using .jpg instead of .jpeg as the file extension; the format is JPEG, not JPG, for crying out loud". *Then* I get to the semantics of what they're doing and complain about needlessly spawning 'ls'. :-)
The article touches my pet hate of the week:
Useless use of ...
for img in `ls *.jpg`
A useless use of ls, and a way to get an unnecessary "argument list" to long error, and *strange* behaviour if there's a directory which matches *.jpg.
Also, I think that breaks some shells if there are spaces in the filenames.
Useless use of ...
Breaks all shells I suspect (I don't know of a single shell that doesn't use whitespace as a token seperator - maybe there's a "torturesh" that doesn't)...Useless use of ...
Given it's not an article on shell scripting, does that really matter? Sure,
Useless use of ...
find . -type f -name "*.jpg" -exec blah {} \;
Is more correct, but it's a lot harder for a newbie to read. I am also sure that the photographic composition of the examples in the article isn't perfect, but it's not an article about how to take a photo, and that is therefore not relevant either.
Nah, you just do:Useless use of ...
Speaking of useless elements ...
for i in *.jpg; do; whateveryouwant; done
Obviously, the one after the do. That won't do anything. It should just be:
for i in *.jpg; do whateveryouwant; done
Then all shall be happy and fluffy and wonderful.
Speaking of useless elements ...
Useless use of find -exec...
find . -type f -name "*.jpg" -exec blah {} \;
find . -name '*.jpg' | xargs blah
find . -name '*.jpg' -print0 | xargs -0 blah
> The article touches my pet hate of the week:Useless use of ...
> for img in `ls *.jpg`