Linux 将 .jpg 转换为 .eps 格式
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/5350246/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Convert .jpg to .eps format
提问by Bhavneet
How can I convert multiple .jpg files to .eps files on Linux?
如何在 Linux 上将多个 .jpg 文件转换为 .eps 文件?
回答by Daniel B?hmer
You can use many tools. I recommend using convert
command from ImageMagick.
您可以使用许多工具。我建议使用convert
ImageMagick 的命令。
#!/bin/bash
# example 1
convert myfile.jpg myfile.eps
# example 2
for file in file1.jpg file2.jpg file3.jpg; do
echo convert "$file" $(echo "$file" | sed 's/\.jpg$/\.eps/')
done
To make example 2 run you need to remove the echo
inside the for
-loop. Make sure the commands it outputs are correct beforeremoving it.
要使示例 2 运行,您需要删除-loop的echo
内部for
。在删除它之前确保它输出的命令是正确的。
回答by reinierpost
回答by ericzma
I do this often and sometimes on Windows. Hence, I wrote a small online converter which uses convert:
我经常这样做,有时在 Windows 上这样做。因此,我编写了一个使用 convert 的小型在线转换器:
Hope this can also help others.
希望这也可以帮助其他人。
回答by user1958943
When using the ImageMagick's convert, it is a good practice to use the eps2 format. This make the resulting eps file much smaller because it uses the JPEG compression algorithm (DCT).
使用 ImageMagick 的转换时,最好使用 eps2 格式。这使得生成的 eps 文件更小,因为它使用 JPEG 压缩算法 (DCT)。
So, to convert a.jpg
to a.eps
do:
因此,要转换a.jpg
为a.eps
:
convert a.jpg eps2:a.eps
This of course, can be used in a shell script, to convert multiple JPG to EPS.
这当然可以在shell脚本中使用,将多个JPG转换为EPS。
回答by tc88
According to user1958943, I used the convert tool as well. However, as the eps3 format gives an even better compression with similar quality as eps2, I suggest to use
根据user1958943,我也使用了转换工具。但是,由于 eps3 格式提供了与 eps2 相似质量的更好压缩,我建议使用
convert a.jpg eps3:a.eps
By the way, this tool also works for png files (and also others) ...
顺便说一下,这个工具也适用于 png 文件(以及其他文件)......
Does anybody know which compression eps3 is using?
有人知道 eps3 正在使用哪种压缩吗?