ImageMagick转换和GNU并行在一起 [英] ImageMagick convert and GNU parallel together

查看:173
本文介绍了ImageMagick转换和GNU并行在一起的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想加快以下命令:

convert -limit memory 64 -limit map 128 -antialias -delay 1x2 final/*.png movie.mp4

我见过其他博客文章并行和转换是一起使用所以我想知道如何使它与上面的命令一起工作。

I have seen other blog posts where parallel and convert were used together so I am wondering how to make it work with the command above.

推荐答案

如果缩小是一个选项,是的你可以用GNU Parallel轻松做到这一点

If downsizing is an option, yes, you can readily do that with GNU Parallel

parallel -j 8 convert {} -resize ... {} ::: *.png

其中 {} 代表文件名,以及要处理的文件列在 ::: 之后。

where {} stands for the filename, and the files to be processed are listed after the :::.

-j 给出并行运行的作业数。

-j gives the number of jobs to run in parallel.

我刚刚创建了100 PNG s 10,000 x 8,000 an d使用

I just created 100 PNGs of 10,000 x 8,000 and resized them to 2,000 x 1,200 sequentially in 8 minutes using

#!/bin/bash
for f in *.png; do
    convert $f -resize 2000x1200! $f
done

然后,再次使用相同的原始图像,但使用GNU Parallel

then, the same original images again, but with GNU Parallel

parallel convert {} -resize 2000x1200! {} ::: *.png

花了3分40秒。随后将这100张 PNG s制作成电影需要52秒。

and it took 3 minutes 40 seconds. Subsequently making those 100 PNGs into a movie took 52 seconds.

这篇关于ImageMagick转换和GNU并行在一起的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆