admin 管理员组文章数量: 1184232
背景
在使用
LaTeX
\LaTeX
L
A
T
E
X
对论文进行排版时,经常需要使用EPS格式的图片,但是使用PPT或者Visio绘制的图形无法直接导出成EPS格式的图片,所以需要将
png
、
jpg
等格式的图片转换为
eps
格式的图片。
方法
总结网上的教程,大致分为一下几种方式:
- 在线转换
- png>pdf>eps
- 使用Python代码实现:
- 使用bmeps命令
1.在线转换
在线转换推荐使用:,注意上传文件的文件名不能包含中文。另外在线转换有一个缺点就是,转换之后图片上的有些字体会变。
2.png>pdf>eps方式
将图片转换为pdf,然后使用Adobe Acrobat将pdf转换成eps图片。过程繁琐,还得下载Adobe Acrobat。所以不推荐
3.使用Python代码实现
from PIL import Image
fig = Image.open("fig.png")
fig = fig.convert('RGB')#The EPS driver can write images in L, RGB and CMYK modes.
fig.save("fig.eps")
fig.close()
这个方法挺不错,但是存在一个致命的问题。当输入的图片是无背景的图片时,输出的eps文件会有问题,与转换之前的图片显示不同。
4.使用bmeps命令(推荐)
在电脑安装了
TeX
\TeX
T
E
X
Live之后,在安装目录的
\bin\win32
目录下会有一个
bmeps.exe
文件。这个可执行文件并不依赖于
TeX
\TeX
T
E
X
Live。所以只需有
bmeps.exe
文件就能使用bmeps命令(末尾有bmeps下载链接)。具体使用方法如下:
bmeps.exe -c fig.png fig.eps
还可以使用
-h
查看帮助文档
bmeps.exe -h
bmeps [options] [ <inputfile> [ <outputfile> ] ]
Options
-------
-p <pslevel> select one of the following
1 (PS level 1)
2 (PS level 2 = default)
3 (PS level 3)
-b BoundingBox file only
-c turns color printing on
-g turns color printing off (default)
-e <encoding> combine the follogin characters to specifiy
8 ASCII-85-encoding instead of ASCII-Hex
r runlength encoding
f flate encoding
-t <filetype> choose one of the following
png
jpg
pnm
-d draft mode only
Draft mode means the program reads only header information
from the bitmap file and prints a dummy image.
-a <alphaoptions>
o alpha channel is opacity, not transparency
t alpha channel is transparency, not opacity
l alternated transparency trigger level
m mix foreground- and background color
sd,d,d specify background color i.e. s128,128,255
PNG supports transparency channels, having values from
0 ... 2^n-1. EPS supports simple yes/no decisions to mask
pixels, so the alpha channels value must be mapped to
"use pixel" or "mask pixel". The standard behaviour is
to mask only pixels which have no opacity at all.
The alternated trigger level uses only pixels having full
opacity.
-s print DSC comments
-o use showpage operator
-u undefine /pstr and /inputf, use
separated dictionary
-r force garbage collection via "1 vmreclaim"
-q use resolution information from the PNG file's
pHYs chunk (if available).
bmeps.exe
文件仅有230KB,而且不依赖
TeX
\TeX
T
E
X
Live。所以推荐使用这种方法来转换图片。
最后附上
bmeps.exe
文件下载链接:
版权声明:本文标题:图像到布局大师:掌握SWF至EPS转换技巧,让你的LaTeX项目更出色 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.roclinux.cn/p/1771905182a3549903.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论