原本是想找到python 操作emf文件保存成ai或者eps或者svg文件,然后拼图。无果。

image.png

EPS文件介绍

找到一个批量转换emf到eps的软件emftoeps

用这个把部分emf转换成eps后,AI打开,很清晰

image.png

想尝试python操作eps来拼接

参考

C:\ProgramData\Anaconda3\Lib\site-packages\ghostscript;

C:\ProgramData\Anaconda3\Lib\site-packages\ghostscript-0.6.dist-info;

还是要用PIL

http://effbot.org/imagingbook/format-eps.htm

PIL identifies EPS files containing image data, and can read files that contain embedded raster images (ImageData descriptors). ** If Ghostscript is available, other EPS files can be read as well. The EPS driver can also write EPS images.

** If Ghostscript is available, other EPS files can be read as well. The EPS driver can also write EPS images.

https://pypi.org/project/elaphe3/0.2.0/

If you want to render barcode into bitmap image, EpsImagePlugin of Python Imaging Library (http://www.pythonware.com/products/pil) or Pillow is required.

** Note that EpsImagePlugin requires Ghostscript is correctly installed**.

一定还是要装好Ghostscript

安装Ghostscript

下面就试着解决这个问题:

官方网站下载Ghostscript 9.26 for Windows (64 bit) 22.3M

https://www.ghostscript.com/download/gsdnld.html

image.png

安装,再试一下,path加入路径,一定要有bin在里面

c:\Program Files\gs\gs9.26\bin;

Image.open(emf).save(outfile,"tiff")

---

Traceback (most recent call last):

File "", line 1, in

Image.open(emf).save(outfile,"tiff") # added "JPEG"

File "C:\ProgramData\Anaconda3\lib\site-packages\PIL\Image.py", line 1899, in save

self.load()

File "C:\ProgramData\Anaconda3\lib\site-packages\PIL\EpsImagePlugin.py", line 337, in load

self.im = Ghostscript(self.tile, self.size, self.fp, scale)

File "C:\ProgramData\Anaconda3\lib\site-packages\PIL\EpsImagePlugin.py", line 137, in Ghostscript

raise WindowsError('Unable to locate Ghostscript on paths')

OSError: Unable to locate Ghostscript on paths

还是不行。。。

又看到:

to the end of the variable. It should be separated from the previous entry by a semicolon.

I had to restart for the changes to take effect.

重启试一下吧。。

重启之后运行不报错了,貌似是可以用了。

不过,保存出来的图片还是丧失掉了可编辑性,分辨率掉的厉害。

image.png

看来还是不行。。

读取eps,调整分辨率,还保存成可编辑的eps,这么困难?

如果不改变分辨率只是缩放,试一下这个

May be it is best if you just specify the desired width instead of the resolution - for example if you want to have it 1677 pixels wide:

def open_eps(filename, width=None):

original_width = float(Image.open(filename).size[0])

im = Image.open(filename)

if width is not None:

im.load(scale=width/original_width)

return im

im = open_eps('testfile.eps', 1677)

1-24 继续折腾一下,找了Pillow官网的eps说明如下

PIL identifies EPS files containing image data, and can read files that contain embedded raster images (ImageData descriptors). If Ghostscript is available, other EPS files can be read as well. The EPS driver can also write EPS images. The EPS driver can read EPS images in L, LAB, RGBand CMYK mode, but Ghostscript may convert the images to RGB mode rather than leaving them in the original color space. The EPS driver can write images in L, RGB and CMYK modes.

If Ghostscript is available, you can call the load() method with the following parameter to affect how Ghostscript renders the EPS

Affects the scale of the resultant rasterized image. If the EPS suggests that the image be rendered at 100px x 100px, setting this parameter to 2 will make the Ghostscript render a 200px x 200px image instead. The relative position of the bounding box is maintained:

im = Image.open(...)

im.size #(100,100)

im.load(scale=2)

im.size #(200,200)

EPS Module 说明

放弃了。。。

python中eps参数_2019-01-23 python PIL 编辑 EPS 文件调整大小并拼接-失败告终相关推荐

  1. python中可选参数_正确使用Python可选参数

    函数的带默认值参数能够很大程度上方便我们使用:一般情况下可以省略传参使用参数的默认值,也可以主动传参:调用的时候也不用在意参数的顺序方便使用,并且直接.显式:甚至还能用来当作魔法值,做一些逻辑上的控制 ...

  2. python 外部参数过长_介绍python中slice参数过长的处理方法及实例

    python教程栏目介绍slice参数过长的处理方法 很多小伙伴对于slice参数的概念理解停留在概念上,切片的参数有三个,分别是step .start .stop .因为参数的值也是多变的,所以我们 ...

  3. Python中inplace参数

    [小白从小学Python.C.Java] [Python-计算机等级考试二级] [Python-数据分析] Python中inplace参数 [太阳]选择题 对于以下python代码表述错误的一项是? ...

  4. html绑定带有形参的函数,Python中函数参数类型和参数绑定

    参数类型 Python函数的参数类型一共有五种,分别是: POSITIONAL_OR_KEYWORD(位置参数或关键字参数) VAR_POSITIONAL(可变参数) KEYWORD_ONLY(关键字 ...

  5. python中可选参数和可变参数_Python函数中的可变长参数详解

    一.Python函数中的参数 1.使用python的函数时,有参数类别,比如位置参数.关键字参数.可变长参数 2.位置参数.关键字参数很好理解,关键是可变长参数经常能见到,但是一直没有搞懂是什么意思 ...

  6. python url解码_对python中url参数编码与解码的实例详解

    一.简介 在python中url,对于中文等非ascii码字符,需要进行参数的编码与解码. 二.关键代码 1.url编码 对字符串编码用urllib.parse包下的quote(string, saf ...

  7. python中的递归思想_〖Python〗-- 递归、面向对象初识及编程思想

    [递归.面向对象初识及编程思想] 一.递归 1.定义: 在函数内部,可以调用其他函数.如果一个函数在内部调用自身本身,这个函数就是递归函数. (1)递归就是在过程或函数里调用自身: (2)在使用递归策 ...

  8. python中获取文件大小_如何在Python中获取文件大小

    python中获取文件大小 We can get file size in Python using the os module. 我们可以使用os模块在Python中获取文件大小. Python中的 ...

  9. python统计元音字母个数_计算Python中的元音(Counting vowels in python)

    计算Python中的元音(Counting vowels in python) def main(): print(count) def countVowels(string): vowel=(&qu ...

最新文章

  1. 第二百二十节,jQuery EasyUI,Slider(滑动条)组件
  2. 有关进行单元测试的时候,不去调本地代码去掉dubbo上的服务
  3. Weblogic 9.2和10.3 改密码 一站完成
  4. 【Verilog HDL 训练】第 09 天(按键消抖)
  5. java常见错误--Access restriction: The type BASE64Encoder
  6. 050_Unicode字符官方标准一
  7. 微众WeCross 跨链平台(12)合约总结
  8. mysql blob key length_mysql – 没有密钥长度的密钥规范中使用的BLOB / TEXT列’bestilling’...
  9. 树莓派(Raspberry Pi)搭建简单的lamp服务
  10. JavaScript 中常见设计模式整理
  11. 一个貌似win窗口的载入框
  12. 编程之美 第1章 游戏之乐——游戏中碰到的题目(九)
  13. silverlight中datagrid数据到处excel
  14. 关于编辑区无法调用chekbox的问题
  15. ubuntu安装rtx
  16. 系统分析与设计方法---面向对象的分析与设计
  17. mysql 后缀 deleted,MySQL · 特性分析 · (deleted) 临时空间
  18. date_sub函数用法-----随笔记
  19. 基于JAVA鞋店销售管理计算机毕业设计源码+系统+mysql数据库+lw文档+部署
  20. 莫纳什大学计算机申请案例,莫纳什大学计算机系统工程学士申请.pdf

热门文章

  1. 五子棋游戏设计VHDL语言
  2. Ubuntu18.04安装VCS、Verdi、dve全套教程亲测(有成功截图)
  3. 基于verilog的洗衣机设计
  4. java 网络文件_java实现从网络下载多个文件
  5. ubuntu linux root,Ubuntu 中的 root 用户:你应该知道的重要事情 | Linux 中国
  6. python自动测试n_接口自动化:Jenkins 自动构建python+nose测试
  7. CTF工具(1)--- ARCHPR--含安装/使用过程
  8. c#与access建立连接用作登录_组态王与Access数据库的数据交换
  9. 【Leetcode_easy】657. Robot Return to Origin
  10. luogu1355 神秘大三角