3 ms·
Love this tool, often end up using it with imagemagick. # Resize all jpgs to 800x600 using 8 jobs/cores. parallel -j 8 convert {} -resize 800x600 {.}_small
by pi-rat 10y ago
Love this tool, often end up using it with imagemagick.
# Resize all jpgs to 800x600 using 8 jobs/cores.
parallel -j 8 convert {} -resize 800x600 {.}_small.jpg ::: *.jpg
# Or get the help of a few servers (via SSH) to do the same job.
parallel -S serverA,serverB -j 8 --transfer --return {.}_small.jpg convert {} -resize 800x600 {.}_small.jpg ::: *.jpg
- dahart 10y agoI do the same thing and resize all the pictures I ever import into both small & thumbnail versions. Fun tip - if your resize script prints only the output file name to stdout, you can pipe the result into another parallel command, e.g., parallel <resize to 800x600> ::: *.jpg | parallel <resize to thumbnail> This way generating thumbnails runs on the small image instead of the full size image, saving more time. Also, if you're on a mac, using sips is quite a bit faster than imagemagick, and sips comes built-in. I've never used servers with parallel for image resizing, what are the benefits? I'd have guessed it would take longer and saturate the network, versus doing it locally. Is it useful for really long running jobs when you don't want to load your local cpu? Is it actually faster sometimes, or are there other more important reasons? I could see it being useful if I didn't have a local imagemagick install, but had access to servers with it there. Maybe it'd be useful in cases where I'm running docker environments for the job processing? What other use cases and scenarios have you run into?
- pi-rat 10y agosips is a good tip, thanks! I often sort and process images with a macbook on my lap curled up on the sofa. Resizing locally makes the mac blazing hot with fans whining - not comfortable and kills the battery. Transfer speed is not too bad over 802.11AC. So I use it mainly as a method of moving cpu intensive work away from my lap. Also, I sometimes use parallel -S server,: ....... The semicolon adds the local machine to the list, it will saturate both the laptop and whatever it manages from the other computer. I have to admit I've never tested this scientifically, but it seems to be faster even with the overhead (gain of remote imagemagick seems to be more than cpu overhead of SSH file transfer).
- dahart 10y ago> I often sort and process images with a macbook on my lap curled up on the sofa. Resizing locally makes the mac blazing hot with fans whining - not comfortable and kills the battery. Transfer speed is not too bad over 802.11AC. So I use it mainly as a method of moving cpu intensive work away from my lap. :) I have the exact same workflow: MacBook+Sofa. Totally trying out the server options today.