PNG to eps conversion massive increase in file siz

2020-02-17 06:40发布

问题:

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

回答1:

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



回答2:

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


回答3:

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



回答4:

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.



回答5:

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.



标签: image png eps