pdftex[940] branches/stable: doc and test for tiny image resolutions

commits+karl at tug.org commits+karl at tug.org
Sat Jan 18 23:50:28 CET 2025


Revision: 940
          https://tug.org/svn/pdftex?view=revision&revision=940
Author:   karl
Date:     2025-01-18 23:50:27 +0100 (Sat, 18 Jan 2025)
Log Message:
-----------
doc and test for tiny image resolutions

Modified Paths:
--------------
    branches/stable/doc/manual/ChangeLog
    branches/stable/doc/manual/pdftex.tex

Added Paths:
-----------
    branches/stable/tests/37-ignore-tiny-image-resolutions/
    branches/stable/tests/37-ignore-tiny-image-resolutions/i.pdf
    branches/stable/tests/37-ignore-tiny-image-resolutions/i.tex
    branches/stable/tests/37-ignore-tiny-image-resolutions/test-1.jpg
    branches/stable/tests/37-ignore-tiny-image-resolutions/test-2.jpg
    branches/stable/tests/37-ignore-tiny-image-resolutions/test-3.jpg
    branches/stable/tests/37-ignore-tiny-image-resolutions/test-4.jpg
    branches/stable/tests/37-ignore-tiny-image-resolutions/test-5.jpg
    branches/stable/tests/37-ignore-tiny-image-resolutions/test-6.jpg

Modified: branches/stable/doc/manual/ChangeLog
===================================================================
--- branches/stable/doc/manual/ChangeLog	2025-01-18 22:43:12 UTC (rev 939)
+++ branches/stable/doc/manual/ChangeLog	2025-01-18 22:50:27 UTC (rev 940)
@@ -1,3 +1,8 @@
+2025-01-18  Karl Berry  <karl at freefriends.org>
+
+	* pdftex.tex (\pdfximage): mention that image metadata is (now)
+	ignored if it's bogus.
+
 2024-08-20  Karl Berry  <karl at freefriends.org>
 
 	* pdftex.tex (\pdfstartlink): give complete url example.

Modified: branches/stable/doc/manual/pdftex.tex
===================================================================
--- branches/stable/doc/manual/pdftex.tex	2025-01-18 22:43:12 UTC (rev 939)
+++ branches/stable/doc/manual/pdftex.tex	2025-01-18 22:50:27 UTC (rev 940)
@@ -92,7 +92,7 @@
 
 \section{Legal notice}
 
-Copyright \copyright\ 1996--2024 \THANH.
+Copyright \copyright\ 1996--2025 \THANH.
 Permission is granted to copy, distribute and/or modify this document
 under the terms of the GNU Free Documentation License, Version 1.2
 or any later version published by the Free Software Foundation;
@@ -749,17 +749,16 @@
 echo "times TimesNewRomanPSMT <8r.enc <times.ttf" >>test.map
 \end{verbatim}
 
-There are a limitations with TrueType fonts in comparison with
-Type~1 fonts:
+TrueType fonts have some limitations in comparison with Type~1 fonts:
 
 \begin{itemize}
-\item  The special effects SlantFont\slash ExtendFont did not work
-       before version 1.40.0.
 \item  To subset a TrueType font, the font must be specified as re\hyph
        encoded, therefore an encoding vector must be given.
 \item  TrueType fonts used in embedded \PDF\ files are kept
        untouched; they are not replaced or merged with the same font
        used in the document, as happens with Type~1.
+\item  The special effects SlantFont\slash ExtendFont did not work
+       before version 1.40.0.
 \end{itemize}
 
 For much more about \PDFTEX\ and TrueType fonts, including many details
@@ -2234,20 +2233,25 @@
 specified values. If some (but not all) are given, the rest will be set
 to a value corresponding to the remaining ones so as to make the image
 size to yield the same proportion of $width : (height+depth)$ as the
-original image size, where depth is treated as zero. If none are given
-then the image will have its natural size.
+original image size, where depth is treated as zero. If no
+\Something{rule spec} is given then the image will have its natural
+size.
 
 An image inserted at its natural size often has a resolution of
 \type{\pdfimageresolution} (see below) given in dots per inch in the
-output file, but some images may contain data specifying the image
-resolution, and in such a case the image will be scaled accordingly. The
-dimensions of an image can be accessed by putting the \cs{pdfrefximage}
-command in a box and checking the box's dimensions:
+output file. However, if an image contains metadata specifying the image
+resolution, the image will be scaled accordingly---unless (as of
+\PDFTEX\ 1.40.27, released in 2025) the embedded image metadata is
+patently incorrect, such as 1dpi x 1dpi, in which case \PDFTEX\ ignores
+the metadata and issues a warning. (Otherwise the bogus data would
+typically lead to an arithmetic overflow error from \TEX.)
 
+The dimensions of an image can be accessed by using the
+\cs{pdfrefximage} command in a box and checking the box's dimensions:
+
 \begin{verbatim}
 \setbox0=\hbox{\pdfximage{somefile.png}\pdfrefximage\pdflastximage}
 \end{verbatim}
-
 Now we can use \cs{wd0} and \cs{ht0} to find the natural size of the
 image as determined by \PDFTEX.
 

Added: branches/stable/tests/37-ignore-tiny-image-resolutions/i.pdf
===================================================================
(Binary files differ)

Index: branches/stable/tests/37-ignore-tiny-image-resolutions/i.pdf
===================================================================
--- branches/stable/tests/37-ignore-tiny-image-resolutions/i.pdf	2025-01-18 22:43:12 UTC (rev 939)
+++ branches/stable/tests/37-ignore-tiny-image-resolutions/i.pdf	2025-01-18 22:50:27 UTC (rev 940)

Property changes on: branches/stable/tests/37-ignore-tiny-image-resolutions/i.pdf
___________________________________________________________________
Added: svn:mime-type
## -0,0 +1 ##
+application/pdf
\ No newline at end of property
Added: branches/stable/tests/37-ignore-tiny-image-resolutions/i.tex
===================================================================
--- branches/stable/tests/37-ignore-tiny-image-resolutions/i.tex	                        (rev 0)
+++ branches/stable/tests/37-ignore-tiny-image-resolutions/i.tex	2025-01-18 22:50:27 UTC (rev 940)
@@ -0,0 +1,48 @@
+% $Id$
+% Public domain. From Max Chernoff.
+% https://tex.stackexchange.com/questions/734919
+
+\catcode`\{=1 \catcode`\}=2
+\output={\global\advance\count0 by 1 \shipout\box255 }
+\pdfoutput=1
+\hsize=6.5in \vsize=11in
+\pdfpagewidth=\hsize \pdfpageheight=\vsize
+\def\eject{\par \penalty-10000 }
+
+\def\loggingall{\tracingcommands2\tracingstats2
+   \tracingpages1\tracingoutput1\tracinglostchars1
+   \tracingmacros2\tracingparagraphs1\tracingrestores1
+   \showboxbreadth1073741823 \showboxdepth1073741823
+}%
+%\loggingall
+
+%% Generate images with ImageMagick:
+%%     for n in $(seq 1 6); do
+%%         convert -units PixelsPerInch -size 1000x1000 xc:#ff0000 -density $n test-$n.jpg
+%%     done
+
+% because these are zero height, they all come out on the same page?
+\pdfximage{test-1.jpg}\pdfrefximage\pdflastximage\eject
+\pdfximage{test-2.jpg}\pdfrefximage\pdflastximage\eject
+\pdfximage{test-3.jpg}\pdfrefximage\pdflastximage\eject
+\pdfximage{test-4.jpg}\pdfrefximage\pdflastximage\eject
+\pdfximage{test-5.jpg}\pdfrefximage\pdflastximage\eject
+\pdfximage{test-6.jpg}\pdfrefximage\pdflastximage\eject
+\end
+
+%\input graphicx
+%\includegraphics{test-1.jpg}
+%\end
+
+% luatex equivalents (from luatex85.sty)
+%\let\pdfximage           \saveimageresource
+%\let\pdflastximage       \lastsavedimageresourceindex
+%\let\pdflastximagepages  \lastsavedimageresourcepages
+%\let\pdfrefximage        \useimageresource
+
+%\documentclass{article}
+%\usepackage{graphicx}
+%\begin{document}
+%\includegraphics{test-1.jpg}
+%\end{document}
+


Property changes on: branches/stable/tests/37-ignore-tiny-image-resolutions/i.tex
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: branches/stable/tests/37-ignore-tiny-image-resolutions/test-1.jpg
===================================================================
(Binary files differ)

Index: branches/stable/tests/37-ignore-tiny-image-resolutions/test-1.jpg
===================================================================
--- branches/stable/tests/37-ignore-tiny-image-resolutions/test-1.jpg	2025-01-18 22:43:12 UTC (rev 939)
+++ branches/stable/tests/37-ignore-tiny-image-resolutions/test-1.jpg	2025-01-18 22:50:27 UTC (rev 940)

Property changes on: branches/stable/tests/37-ignore-tiny-image-resolutions/test-1.jpg
___________________________________________________________________
Added: svn:mime-type
## -0,0 +1 ##
+image/jpeg
\ No newline at end of property
Added: branches/stable/tests/37-ignore-tiny-image-resolutions/test-2.jpg
===================================================================
(Binary files differ)

Index: branches/stable/tests/37-ignore-tiny-image-resolutions/test-2.jpg
===================================================================
--- branches/stable/tests/37-ignore-tiny-image-resolutions/test-2.jpg	2025-01-18 22:43:12 UTC (rev 939)
+++ branches/stable/tests/37-ignore-tiny-image-resolutions/test-2.jpg	2025-01-18 22:50:27 UTC (rev 940)

Property changes on: branches/stable/tests/37-ignore-tiny-image-resolutions/test-2.jpg
___________________________________________________________________
Added: svn:mime-type
## -0,0 +1 ##
+image/jpeg
\ No newline at end of property
Added: branches/stable/tests/37-ignore-tiny-image-resolutions/test-3.jpg
===================================================================
(Binary files differ)

Index: branches/stable/tests/37-ignore-tiny-image-resolutions/test-3.jpg
===================================================================
--- branches/stable/tests/37-ignore-tiny-image-resolutions/test-3.jpg	2025-01-18 22:43:12 UTC (rev 939)
+++ branches/stable/tests/37-ignore-tiny-image-resolutions/test-3.jpg	2025-01-18 22:50:27 UTC (rev 940)

Property changes on: branches/stable/tests/37-ignore-tiny-image-resolutions/test-3.jpg
___________________________________________________________________
Added: svn:mime-type
## -0,0 +1 ##
+image/jpeg
\ No newline at end of property
Added: branches/stable/tests/37-ignore-tiny-image-resolutions/test-4.jpg
===================================================================
(Binary files differ)

Index: branches/stable/tests/37-ignore-tiny-image-resolutions/test-4.jpg
===================================================================
--- branches/stable/tests/37-ignore-tiny-image-resolutions/test-4.jpg	2025-01-18 22:43:12 UTC (rev 939)
+++ branches/stable/tests/37-ignore-tiny-image-resolutions/test-4.jpg	2025-01-18 22:50:27 UTC (rev 940)

Property changes on: branches/stable/tests/37-ignore-tiny-image-resolutions/test-4.jpg
___________________________________________________________________
Added: svn:mime-type
## -0,0 +1 ##
+image/jpeg
\ No newline at end of property
Added: branches/stable/tests/37-ignore-tiny-image-resolutions/test-5.jpg
===================================================================
(Binary files differ)

Index: branches/stable/tests/37-ignore-tiny-image-resolutions/test-5.jpg
===================================================================
--- branches/stable/tests/37-ignore-tiny-image-resolutions/test-5.jpg	2025-01-18 22:43:12 UTC (rev 939)
+++ branches/stable/tests/37-ignore-tiny-image-resolutions/test-5.jpg	2025-01-18 22:50:27 UTC (rev 940)

Property changes on: branches/stable/tests/37-ignore-tiny-image-resolutions/test-5.jpg
___________________________________________________________________
Added: svn:mime-type
## -0,0 +1 ##
+image/jpeg
\ No newline at end of property
Added: branches/stable/tests/37-ignore-tiny-image-resolutions/test-6.jpg
===================================================================
(Binary files differ)

Index: branches/stable/tests/37-ignore-tiny-image-resolutions/test-6.jpg
===================================================================
--- branches/stable/tests/37-ignore-tiny-image-resolutions/test-6.jpg	2025-01-18 22:43:12 UTC (rev 939)
+++ branches/stable/tests/37-ignore-tiny-image-resolutions/test-6.jpg	2025-01-18 22:50:27 UTC (rev 940)

Property changes on: branches/stable/tests/37-ignore-tiny-image-resolutions/test-6.jpg
___________________________________________________________________
Added: svn:mime-type
## -0,0 +1 ##
+image/jpeg
\ No newline at end of property


More information about the pdftex-commits mailing list.