PNG to eps conversion massive increase in file size

前端 未结 5 1369
走了就别回头了
走了就别回头了 2020-12-24 02:18

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 usin

相关标签:
5条回答
  • 2020-12-24 02:58

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

    0 讨论(0)
  • 2020-12-24 03:10

    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
    
    0 讨论(0)
  • 2020-12-24 03:15

    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.

    0 讨论(0)
  • 2020-12-24 03:16

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

    0 讨论(0)
  • 2020-12-24 03:16

    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.

    0 讨论(0)
提交回复
热议问题