php - 在一行中运行多个 inkscape 命令

标签 php inkscape

是否可以在一个 exec 命令中运行多个命令?我需要从 SVG 文件中抓取一些图像,但这个变体太慢了:

exec('inkscape file.svg --export-id=g123 --export-png=img1.png');
exec('inkscape file.svg --export-id=g124 --export-png=img2.png');
exec('inkscape file.svg --export-id=g125 --export-png=img3.png');

所以我需要在一行中完成所有事情。我已经尝试过这个:

exec('inkscape file.svg --export-id=g125 --export-png=img3.png inkscape file.svg --export-id=g123 --export-png=img1.png');

但这仅提取最后一个图像。

最佳答案

exec() 本身并不慢。但每次调用时,您首先启动 Inkscape,执行操作并再次关闭它。也就是说,需要这么长时间。

不幸的是,Inkscape 没有批处理模式。但是你可以使用Gimp ,可以批量执行相同的操作。

关于php - 在一行中运行多个 inkscape 命令,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6870892/

相关文章:

linux - 如何管道虚拟文件?

animation - 应用变换矩阵后计算路径中心

java - ProcessBuilder 与 Runtime.exec()

svg - pdf 到 svg 并不完美

svg - 如何防止 Inkscape 在导出 SVG 时添加变换?

php - 如何从 Action 中在后台正确运行 Symfony 任务?

php - Mysql 服务器在 LONGBLOB 中存储大型 (2MB) 音频文件时消失了

php - 如何使用 Bootstrap 表单将数据插入到 phpmyadmin 表中

php - 有没有办法将 React 合并到现有的 Laravel 5.2 应用程序中?

php - 对于每个输出(sql)一个不同的类