开发者

Convert .jpg to .eps format [closed]

开发者 https://www.devze.com 2023-02-17 10:02 出处:网络
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.

This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.

Closed 7 years ago.

Improve this que开发者_运维问答stion

How can I convert multiple .jpg files to .eps files on Linux?


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).

So, to convert a.jpg to a.eps do:

convert a.jpg eps2:a.eps

This of course, can be used in a shell script, to convert multiple JPG to EPS.


You can use many tools. I recommend using convert command from 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 before removing it.


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

convert a.jpg eps3:a.eps

By the way, this tool also works for png files (and also others) ...

Does anybody know which compression eps3 is using?


Another option is to combine jpegtopnm and pnmtops from the netpbm toolkit. This will however produce PS, not EPS.

for f in *.jpg
do
  g=`echo "$f" | sed 's/\.jpg$/\.eps/'`
  echo "$f -> $g" 1>&2
  jpegtopnm $f | pnmtops > $g
done


ImageMagick's convert can do that for you.


I do this often and sometimes on Windows. Hence, I wrote a small online converter which uses convert:

JPG to EPS Converter.

Hope this can also help others.

0

精彩评论

暂无评论...
验证码 换一张
取 消