APLawrence.com -  Resources for Unix and Linux Systems, Bloggers and the self-employed

Automating jpeg conversions

A thread at comp.os.linux.mis recently asked how to control the GUI in order to automate the manipulation of some .jpg files with xv. Of course this can be done (see Xmacroplay), but as many posters pointed out, that's simply the wrong tool for the job: ImageMagick is chock-full of command line tools for graphics files.

As an aside, I'll also point out the fault of asking the wrong question. When you are trying to use a flat blade screwdriver to extract a Philips screw, don't ask where you can get the right size flat blade to fit in the Philips slot. In this case, the poster should have asked "How can I batch convert a bunch of image files?" rather than assuming that it had to be done in the graphical tool he was using.

As I and most of the readers here well know, the command line is becoming less popular than ever, and unfortunately that's true in the Linux world as well. There seem to be a lot of Linux folk who live entirely in the gui. The Linux distro's encourage this: I did a Suse install yesterday and had a heck of a time convincing it that I only wanted text mode. In fact, the text mode install seems to even be a little bit broken as it hangs dead at the end. When it reboots to ask the final configuration questions, it again wants and expects to be running a gui and only enters the text based configuration after apologizing for not being able to!

The thread was interesting in another way, too. Someone suggested using Perl with the Image::Magick module , which caused someone else to complain that using a 19 line Perl script to replace a shell one liner was not that great an idea either. The person who suggested the Perl rightfully pointed out that someone wanting to do this sort of thing might want to do more complicated things too, and the Perl script could easily be expanded to do so. He (or she) is absolutely right: shell scripting starts getting clunky pretty quickly. Of course Perl gets clunky at some other point of complexity, but does very, very well in between.

The GUI crowd (some of the GUI crowd) may not understand the value of command line scripting (shell, Perl, or name your poison), but that's simply their failing. GUI's are great for some tasks, and those of us who do appreciate command line scripting know that: we cheerfully use GUI's when it makes sense to do so, and use command line tools when it doesn't. We don't use Lynx for day to day browsing, but we don't generally resort to simulating keystrokes in Windows to get other jobs done. The right tool for the right job.



Got something to add? Send me email.





(OLDER)    <- More Stuff -> (NEWER)    (NEWEST)   

Printer Friendly Version

-> -> Automating jpeg conversions




Increase ad revenue 50-250% with Ezoic


More Articles by

Find me on Google+

© Tony Lawrence



Kerio Samepage


Have you tried Searching this site?

Unix/Linux/Mac OS X support by phone, email or on-site: Support Rates

This is a Unix/Linux resource website. It contains technical articles about Unix, Linux and general computing related subjects, opinion, news, help files, how-to's, tutorials and more.

Contact us





Whenever the literary German dives into a sentence, that is the last you are going to see of him till he emerges on the other side of his Atlantic with his verb in his mouth. (Mark Twain)

I can’t go to a restaurant and order food because I keep looking at the fonts on the menu. (Donald Knuth)







This post tagged: