On Jan 9, 2011 3:09 PM, "Stan Hoeppner" <s...@hardwarefreak.com> wrote:
>
> shawn wilson put forth on 1/9/2011 11:43 AM:
> > On Jan 9, 2011 12:17 PM, "Stan Hoeppner" <s...@hardwarefreak.com> wrote:
> >>
> >> Camaleón put forth on 1/9/2011 10:59 AM:
> >>
> >>> http://www.imagemagick.org/Usage/api/#speed
> >>>
> >>> The above doc provides hints on how to speed-up image magick
operations.
> >>>
> >>> Note that multi-threading should be automatically used whether
possible,
> >>> as per this paragraph:
> >>>
> >>> ***
> >>> # IM by default uses multiple threads for image processing operations.
> >>> That means you can have the computer do two or more separate threads
of
> >>> image processing, it will be faster than a single CPU machine.
> >>> ***
> >>>
> >>> I'm afraid you will have to find out whether your IM package was
> > compiled
> >>> with multi-threading capablities.
> >>
> >> I'm using the i386 Lenny package.  Obviously it wasn't, or it would be
> >> working, and it is not.
> >>
> >> No script ideas Camaleón?  You're not a script kiddie?
> >>
> >
> > If parallel does actually have the same args as xargs than you should be
> > able to convert this fairly easily:
> >
> > find -type f -iname "*. jpg" -print0 ¦ xargs -0 -i{} convert {} -resize
1024
> > {}
>
> I don't quite follow this Shawn.  Will this command line simply
> simultaneously launch one convert process for each jpg file in the
> directory?  I.e. if I have 500 photos in the directory will this command
> line simply fire up 500 simultaneous convert processes?
>

I think your question has been answered. However what that does is find all
jpg files with a case insensitive match (iname vs name). The print0 is
pretty specific to xargs (though you could probably just -print and pipe it
through and do "{}" in xargs with the same effect). xargs takes that input
and knows about find's -print0 with the -0 switch and -i{} tells it to use
{} as a place holder for what it gets as input.

I prefer to use find for searching for files because it is fast, very
customizable and has a nice File::Find template builder with find2perl. Also
since Bob pointed out that xargs has the -P option, you might just use that
along with find's searching and I don't think you'll get much better results
(use -type f with find will speed that up a bit too).

Reply via email to