jpg/latex

Reinhard Kotucha reinhard.kotucha at web.de
Sun Nov 17 00:12:16 CET 2019


On 2019-11-16 at 19:49:41 +0000, Peter Flynn wrote:

 > On 16/11/2019 19:04, Schneider, Thomas (NIH/NCI) [E] via texhax wrote:
 > > Walt:
 > > 
 > > As Peter Flynn explained, LaTeX cannot use JPG, it uses eps.  I
 > > use LaTeX all the time.  The simplest solution is to convert the
 > > image to eps.
 > 
 > You certainly can, but all that does is create a character-based
 > encoding of the image and enclose it in an EPS wrapper. The result
 > is many times the size of the original JPG.

PostScript provides the DCTEncode and DCTDecode filters which means
that JPEG is supported natively.  Converting binary data to ASCII is
done by the ASCII85Encode filter which replaces 4 bytes of binary data
with 5 ASCII characters.  The size of a file is increased only by the
factor 5/4.  ASCII85 is more efficient than base64 in this respect.

If you are interested in small files, try the program sam2p written by
by Péter Szabó.

  https://pts.50.hu/sam2p
  https://ctan.org/pkg/sam2p
  https://github.com/pts/sam2p

sam2p converts a plethora of bitmap formats to either PostScript or
PDF.  Though output files are quite small, conversion is lossless.

TeX Live provides sam2p for Windows.  On Linux at least Debian
provides it (apt install sam2p). CentOS is not aware of it, but 
compiling the program from the sources is not difficult at all.

I don't know whether MacTeX provides sam2p already.  IMO the program
is extremely useful.

Regards,
  Reinhard

-- 
------------------------------------------------------------------
Reinhard Kotucha                            Phone: +49-511-3373112
Marschnerstr. 25
D-30167 Hannover                    mailto:reinhard.kotucha at web.de
------------------------------------------------------------------



More information about the texhax mailing list