PNG to eps conversion massive increase in file siz

2020-02-17 07:11发布

I'm converting an image from .png to .eps and it hugely increases the file size. Can anyone explain why this is, and how to prevent it increasing so much.

I'm using Unix convert: convert image.png image.eps

Thanks for any help

标签: image png eps
5条回答
小情绪 Triste *
2楼-- · 2020-02-17 07:23

I had a similar problem and solved it using the -sample parameter:

convert image.png -sample 100 image.eps

and tweak the -sample value to fit your need.

Also see ImageMagick v6 Examples -- Resize or Scaling

N.B. The inverse (from EPS/PDF to PNG/JPG) can be tuned using -density.

查看更多
3楼-- · 2020-02-17 07:31

Use level 3 postscript if you can. In general, level 3 will produce the smallest files. Level 2 provides the best compatibility, and works well with jpeg images. (see http://electron.mit.edu/~gsteele/pdf/)

convert fig.png eps3:fig.eps
查看更多
淡お忘
4楼-- · 2020-02-17 07:40

Converting a PNG file (designed for bitmap data) into an EPS (designed for vector data) is always going to result in a larger file size, as the EPS is effectively just wrapping an EPS data structure around the original image data (which it most likely won't store in anywhere near as effective a manner as a PNG file).

The correct solution is to store bitmaps as PNGs and vector graphics as EPS or SVG, etc. (i.e.: Use the appropriate file format for the content in question rather than attempting to impose a meaningless "one size fits all" approach.)

查看更多
小情绪 Triste *
5楼-- · 2020-02-17 07:40

convert indeed blows up the file size because it stores the graphics data uncompressed. A better compression and smaller file size can be achieved by e.g. manually converting using gimp, or by doing

convert image.png image.pdf
pdftops -eps image.pdf

In my case, for example, this results in an eps file with a size of 0.3 MB instead of 5.2 MB (when using convert file.png file.eps directly).

查看更多
贼婆χ
6楼-- · 2020-02-17 07:45

It is possible that the problem is that the convert application you use just does not support embedding PNG into EPS. When using properly configured Adobe Acrobat Professional I newer got unexpectedly huge increase of the file size. But you should properly configure first your "PNG to PDF" conversion settings. Then you should export (or Save As) generated PDF as EPS from Acrobat.

查看更多
登录 后发表回答