posted Jun 28, 2012, 6:40 PM by Teng-Yok Lee
[
updated Jan 2, 2021, 7:40 PM
]
To Embed
figures in LaTeX files, .eps format is often used but the file sizes
are too big. Using other formats such .PNG might be incompatible with
TeX/LaTeX. Therefore, .EPS is still the better choice. To reduce the
file size, .eps.gz is another good choice. The following steps could be
applied.
- Prerequisite: Install gzip, grep, and ImageMagick. For Windows, please add the path to their executable to the environment variable PATH.
- Add the following rule at the beginning of the LaTeX file after the
library graphix:
- \DeclareGraphicsExtensions{.eps,.eps.gz}
- \DeclareGraphicsRule{.eps.gz}{eps}{.bb}{}
- Convert the image, for instance, img.png to .eps
- Extract the BoundingBox
- grep "%%BoundingBox" img.eps > img.bb
- Compress the .eps file
The attached archive contain a Windows .bat file to convert an image file to .eps.gz with .bb. The most updated one now can be cloned from GIT: https://github.com/recheliu/png2epsgz/blob/master/png2epsgz.bat. Based on this script with the looping scheme in the shell, the images in a folder can be computed in a single command. |
 Updating...
Teng-Yok Lee, Dec 9, 2012, 8:35 AM
|