Reducing size of EPS file after export from GIMP
Solution 1
I would suggest using sam2p instead of the GIMP: it will convert the JPEG to EPS (and several other formats, including PDF) in a way that preserves the existing JPEG compression, which will presumably lead to less expansion as well as avoiding image degradation. (It also works on several other input formats, including PNG and GIF
Note, however, that if you are going to be converting the result into PDF at some point using Ghostscript, it will stupidly decompress the image and then (by default) recompress it using JPEG-style compression (again, by default). Whether or not Ghostscript recompresses the image, just decompressing it discards information.
If you plan to include the figure in a (La)TeX document, you should consider using pdf(La)TeX, which can include JPEG and PNG images directly (though even if it couldn't, you could use sam2p to convert the images to single-page PDF and include that instead). This will prevent any loss of image data and should use about the same size in the PDF as in the JPEG file.
Solution 2
You don’t want to use a bitmap editor (including GIMP or ImageMagick) to convert a JPEG to EPS. The image will be decompressed and the file size will increase by an order of magnitude. It may be possible to recompress the image, but you’ll have lost quality. Unfortunately, Inkscape can’t do this either, thanks to limitations in Cairo. This Jpeg2ps tool may be of interest (though I haven’t tried it). Whatever you do, look for DCTDecode
in the EPS output.
Solution 3
JPEG is a binary format while EPS is a text format. Since it takes two hexadecimal characters to represent each byte, that alone doubles the size of your file, roughly speaking. Also, JPEG is compressed. I don't know whether the bitmap contained in the EPS file is uncompressed, but it's likely given the great difference in sizes. The difference in size between the JPEG header and the Postscript instructions is a small contributing factor.
You may find that running the following command will reduce the file size somewhat:
eps2eps inputfile.eps outputfile.eps
You will need to have Ghostscript installed in order to have the eps2eps
utility.
It's possible that ImageMagick would do a better conversion than Gimp.
convert inputfile.jpg outputfile.eps
Related videos on Youtube
devin
Updated on September 17, 2022Comments
-
devin over 1 year
I have a jpeg file that's 400k that I used gimp to convert to eps. The eps file is 10.8 MB. I didn't make any modifications other than cropping. Why is it so large and how do I reduce the size.
-
SamB over 13 yearsShouldn't this be tagged
eps
andjpeg
??
-
-
devin over 13 yearswhat do you mean?
-
Josh Lee over 13 yearsThe
eps2eps
command reduced a file from 10.7MB to 5.9MB for me — it seems to translate the ascii-hex image to a more compact ascii encoding. -
Josh Lee over 13 yearsOoh, sam2p is in Debian, while jpeg2ps is not.
-
Blaisorblade over 11 years"Look for DCTDecode in the EPS output." What do you mean? Should it be there, not be there, or what?