[texhax] help

Reinhard Kotucha reinhard.kotucha at web.de
Sat Dec 15 01:46:33 CET 2018


On 2018-11-22 at 11:50:10 +0000, Peter Flynn wrote:

 > I have just rewritten the section on image file formats in _Formatting
 > Information_, triggered by what Reinhard said the other day, so feel
 > free to use that (and let me know if it contains errors):
 > 
 > http://latex.silmaril.ie/formattinginformation/images.html#fileformats

Dear Peter,
from the document mentioned above: 

 >   1. PNG actually gets converted to the PDF internal format
 >      automatically (at a small penalty in terms of speed) so for
 >      lots of images, or very large images, use JPG format or
 >      preconvert them to PDF;

Please never recommend to convert PNG to JPEG. JPEG uses lossy
compression optimized for photographs.  For screenshots, for instance,
PNG is much better because it doensn't suffer from the JPEG artifacts.

Many people, especially in the Windows world, believe that JPEG files
are always smaller than PNG files.  This is only true if you don't
care about quality.  If you want to achieve same quality (i.e., avoid
the JPEG artifacts), a JPEG file is most likely much larger than a PNG
file.

IMO it's best to teach TeX users to use vector graphics whenever
possible.  For everything else PNG is the best choice.  JPEG should
only be used for photographs but nothing else.

 >   2. It is also of course possible to convert (repackage) your JPG
 >      pictures to PDF, using any of the standard graphics
 >      conversion/manipulation programs (see § 4.4.1.1 for
 >      details). Preconverting all your images to PDF makes them load
 >      into your document slightly faster.

Conversion doesn't make sense here because JPEG is supported by PDF
natively.  Hence, a JPEG file is inserted into a PDF file as-is.
Pre-processing is only useful if the pre-processor is able to do some
optimizations.

 >  3. XƎLATEX and PDFLATEX will search for the graphic file by file
 >     type, in this order (check for the newest definition in your
 >     pdftex.def): .png, .pdf, .jpg, .mps, .jpeg, .jbig2, .jb2, .PNG,
 >     .PDF, .JPG, .JPEG, .JBIG2, and .JB2. [...]
 
This behaviour doesn't depend on the TeX engine you are using.  The
behaviour is defined in a LaTeX macro package which is used by all
LaTeX engines, so you could mention LuaTeX as well.

The search order is obviously wrong but can't be changed without
breaking existing documents.  It's wrong to look for .png files before
looking for .pdf files.

The solution is not to rely on this order at all.

  \includegraphics{myfile.pdf}

instead of

  \includegraphics{myfile}

 > sam2p (not available with TEX Live but downloadable for Windows and
 > Linux).

On Windows Sam2p is part of the TeX Live distribution.  No need to
download anything.

BTW, the name of the file format is JPEG, not JPG.  

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