TransWikia.com

scalebox error on PDF images?

TeX - LaTeX Asked on June 25, 2021

I’m not sure I understand what is happening, but it seems that if the magnification is a certain amount (x10) on a scalebox of a certain PDF (example-image-a via includegraphics), the content of the result is in error.

In the MWE, I take example-image-a in PDF, png, and jpg formats. I trim a total of 80% of the width and height, always the same in each case. Then I scale the result by a factor of 10 (or 9 in one case). The reference image is shown on the right, for comparison.

The first thing is that the images are of different heights. I don’t think that is an issue…it just means the original PDF version was of a smaller size than the corresponding png and jpg versions. However, focus on the two left images, which are the PDF version scaled by a factor of 9 and a factor of 10, respectively. The factor of 9 gives the proper result, which matches the content (if not the scale) of the 3rd (png) and 4th (jpg) images. However, the 2nd image, which is a scale-factor of 10, loses the black part of the letter A.

If I uncomment the renewcommand, to nullify the final scalebox, the black part of the 2nd image returns, which means it was there to begin with, prior to the final scalebox.

Is this because I am using temporary boxes 6 and 8? Does it have something to do with PDF image layers? Is it something simple I am missing? Or is there a more general problem at work here?

documentclass[margin=0.1cm] {standalone}
usepackage{graphicx}
usepackage{trimclip}
%renewcommandscalebox[2]{#2}% TO CANCEL THE SCALING
begin{document}
sbox8{includegraphics{example-image-a.pdf}}
sbox6{clipbox{.5wd8{} .25ht8{} .3wd8{} .55ht8}{copy8}}
scalebox{9}{copy6}
%vs 
sbox8{includegraphics{example-image-a.pdf}}
sbox6{clipbox{.5wd8{} .25ht8{} .3wd8{} .55ht8}{copy8}}
scalebox{10}{copy6}
%vs.
sbox8{includegraphics{example-image-a.png}}
sbox6{clipbox{.5wd8{} .25ht8{} .3wd8{} .55ht8}{copy8}}
scalebox{10}{copy6}
%vs.
sbox8{includegraphics{example-image-a.jpg}}
sbox6{clipbox{.5wd8{} .25ht8{} .3wd8{} .55ht8}{copy8}}
scalebox{10}{copy6}
%vs.
scalebox{2}{copy8}
end{document}

enter image description here

Again, with scaling nullified by way of the renewcommand:

enter image description here

UPDATE:

After Ulrike related that she cannot reproduce the situation, I checked the log file and found this warning. I don’t know how relevant it is:

pdfTeX warning: miktex-pdftex.exe (file C:/Users/steven.segletes/AppData/Roamin
g/MiKTeX/2.9/tex/latex/mwe/example-image-a.pdf): PDF inclusion: found PDF versi
on <1.5>, but at most version <1.4> allowed

I updated my installation of MikTeX to the latest:

pdfTeX, Version 3.141592653-2.6-1.40.22 (MiKTeX 21.3) (preloaded format=pdflatex 2021.5.19)

I also downloaded the latest version of example-image-a.pdf from https://ctan.org/tex-archive/macros/latex/contrib/mwe and there was no resulting difference with either of these updates, either to the warning or to the appearance of the output.

UPDATE 2

I discovered that the PDF renders properly in Adobe Reader, but not in TeXworks.

Here is the logfile, as Ulrike asked:

This is pdfTeX, Version 3.141592653-2.6-1.40.22 (MiKTeX 21.3) (preloaded format=pdflatex 2021.4.14)  20 MAY 2021 16:33
entering extended mode
**./junk.tex
(junk.tex
LaTeX2e <2020-10-01> patch level 4
L3 programming layer <2021-02-18>
(C:UsersStevenAppDataLocalProgramsMiKTeX 2.9tex/latex/standalonestandal
one.cls
Document Class: standalone 2018/03/26 v1.3a Class to compile TeX sub-files stan
dalone

(C:UsersStevenAppDataLocalProgramsMiKTeX 2.9tex/latex/latex-toolsshelle
sc.sty
Package: shellesc 2019/11/08 v1.0c unified shell escape interface for LaTeX
Package shellesc Info: Restricted shell escape enabled on input line 77.
)
(C:UsersStevenAppDataLocalProgramsMiKTeX 2.9tex/generic/iftexifluatex.s
ty
Package: ifluatex 2019/10/25 v1.5 ifluatex legacy package. Use iftex instead.

(C:UsersStevenAppDataLocalProgramsMiKTeX 2.9tex/generic/iftexiftex.sty
Package: iftex 2020/03/06 v1.0d TeX engine tests
))
(C:UsersStevenAppDataLocalProgramsMiKTeX 2.9tex/latex/xkeyvalxkeyval.st
y
Package: xkeyval 2020/11/20 v2.8 package option processing (HA)

(C:UsersStevenAppDataLocalProgramsMiKTeX 2.9tex/generic/xkeyvalxkeyval.
tex
(C:UsersStevenAppDataLocalProgramsMiKTeX 2.9tex/generic/xkeyvalxkvutils
.tex
XKV@toks=toks15
XKV@tempa@toks=toks16

(C:UsersStevenAppDataLocalProgramsMiKTeX 2.9tex/generic/xkeyvalkeyval.t
ex))
XKV@depth=count179
File: xkeyval.tex 2014/12/03 v2.7a key=value parser (HA)
))
sa@internal=count180
c@sapage=count181

(C:UsersStevenAppDataLocalProgramsMiKTeX 2.9tex/latex/standalonestandal
one.cfg
File: standalone.cfg 2018/03/26 v1.3a Default configuration file for 'standalon
e' class
)
(C:UsersStevenAppDataLocalProgramsMiKTeX 2.9tex/latex/basearticle.cls
Document Class: article 2020/04/10 v1.4m Standard LaTeX document class
(C:UsersStevenAppDataLocalProgramsMiKTeX 2.9tex/latex/basesize10.clo
File: size10.clo 2020/04/10 v1.4m Standard LaTeX file (size option)
)
c@part=count182
c@section=count183
c@subsection=count184
c@subsubsection=count185
c@paragraph=count186
c@subparagraph=count187
c@figure=count188
c@table=count189
abovecaptionskip=skip47
belowcaptionskip=skip48
bibindent=dimen138
)
sa@box=box47
)
(C:UsersStevenAppDataLocalProgramsMiKTeX 2.9tex/latex/graphicsgraphicx.
sty
Package: graphicx 2020/09/09 v1.2b Enhanced LaTeX Graphics (DPC,SPQR)

(C:UsersStevenAppDataLocalProgramsMiKTeX 2.9tex/latex/graphicsgraphics.
sty
Package: graphics 2020/08/30 v1.4c Standard LaTeX Graphics (DPC,SPQR)

(C:UsersStevenAppDataLocalProgramsMiKTeX 2.9tex/latex/graphicstrig.sty
Package: trig 2016/01/03 v1.10 sin cos tan (DPC)
)
(C:UsersStevenAppDataLocalProgramsMiKTeX 2.9tex/latex/graphics-cfggraph
ics.cfg
File: graphics.cfg 2016/06/04 v1.11 sample graphics configuration
)
Package graphics Info: Driver file: pdftex.def on input line 105.

(C:UsersStevenAppDataLocalProgramsMiKTeX 2.9tex/latex/graphics-defpdfte
x.def
File: pdftex.def 2020/10/05 v1.2a Graphics/color driver for pdftex
))
Gin@req@height=dimen139
Gin@req@width=dimen140
)
(C:UsersStevenAppDataLocalProgramsMiKTeX 2.9tex/latex/adjustboxtrimclip
.sty
Package: trimclip 2020/08/19 v1.2 Trim and clip general TeX material

(C:UsersStevenAppDataLocalProgramsMiKTeX 2.9tex/latex/collectboxcollect
box.sty
Package: collectbox 2012/05/17 v0.4b Collect macro arguments as boxes
collectedbox=box48
)
(C:UsersStevenAppDataLocalProgramsMiKTeX 2.9tex/latex/adjustboxadjcalc.
sty
Package: adjcalc 2012/05/16 v1.1 Provides advanced setlength with multiple back
-ends (calc, etex, pgfmath)
)
tc@llx=dimen141
tc@lly=dimen142
tc@urx=dimen143
tc@ury=dimen144
Package trimclip Info: Using driver 'tc-pdftex.def'.

(C:UsersStevenAppDataLocalProgramsMiKTeX 2.9tex/latex/adjustboxtc-pdfte
x.def
File: tc-pdftex.def 2019/01/04 v2.2 Clipping driver for pdftex
))
(C:UsersStevenAppDataLocalProgramsMiKTeX 2.9tex/latex/l3backendl3backen
d-pdftex.def
File: l3backend-pdftex.def 2021-03-18 L3 backend support: PDF output (pdfTeX)
l__color_backend_stack_int=count190
l__pdf_internal_box=box49
) (junk.aux)
openout1 = `junk.aux'.

LaTeX Font Info:    Checking defaults for OML/cmm/m/it on input line 5.
LaTeX Font Info:    ... okay on input line 5.
LaTeX Font Info:    Checking defaults for OMS/cmsy/m/n on input line 5.
LaTeX Font Info:    ... okay on input line 5.
LaTeX Font Info:    Checking defaults for OT1/cmr/m/n on input line 5.
LaTeX Font Info:    ... okay on input line 5.
LaTeX Font Info:    Checking defaults for T1/cmr/m/n on input line 5.
LaTeX Font Info:    ... okay on input line 5.
LaTeX Font Info:    Checking defaults for TS1/cmr/m/n on input line 5.
LaTeX Font Info:    ... okay on input line 5.
LaTeX Font Info:    Checking defaults for OMX/cmex/m/n on input line 5.
LaTeX Font Info:    ... okay on input line 5.
LaTeX Font Info:    Checking defaults for U/cmr/m/n on input line 5.
LaTeX Font Info:    ... okay on input line 5.

(C:UsersStevenAppDataLocalProgramsMiKTeX 2.9tex/context/base/mkiisupp-p
df.mkii
[Loading MPS to PDF converter (version 2006.09.02).]
scratchcounter=count191
scratchdimen=dimen145
scratchbox=box50
nofMPsegments=count192
nofMParguments=count193
everyMPshowfont=toks17
MPscratchCnt=count194
MPscratchDim=dimen146
MPnumerator=count195
makeMPintoPDFobject=count196
everyMPtoPDFconversion=toks18
)
(C:UsersStevenAppDataLocalProgramsMiKTeX 2.9tex/latex/epstopdf-pkgepsto
pdf-base.sty
Package: epstopdf-base 2020-01-24 v2.11 Base part for package epstopdf
Package epstopdf-base Info: Redefining graphics rule for `.eps' on input line 4
85.

(C:UsersStevenAppDataLocalProgramsMiKTeX 2.9tex/latex/00miktexepstopdf-
sys.cfg
File: epstopdf-sys.cfg 2021/03/18 v2.0 Configuration of epstopdf for MiKTeX
))

pdfTeX warning: miktex-pdftex.exe (file C:/Users/Steven/AppData/Local/Programs/
MiKTeX 2.9/tex/latex/mwe/example-image-a.pdf): PDF inclusion: found PDF version
 <1.5>, but at most version <1.4> allowed
<example-image-a.pdf, id=1, 321.2pt x 240.9pt>
File: example-image-a.pdf Graphic file (type pdf)
<use example-image-a.pdf>
Package pdftex.def Info: example-image-a.pdf  used on input line 6.
(pdftex.def)             Requested size: 321.19922pt x 240.8994pt.
File: example-image-a.pdf Graphic file (type pdf)
<use example-image-a.pdf>
Package pdftex.def Info: example-image-a.pdf  used on input line 10.
(pdftex.def)             Requested size: 321.19922pt x 240.8994pt.
<example-image-a.png, id=2, 401.5pt x 301.125pt>
File: example-image-a.png Graphic file (type png)
<use example-image-a.png>
Package pdftex.def Info: example-image-a.png  used on input line 14.
(pdftex.def)             Requested size: 401.49901pt x 301.12425pt.
<example-image-a.jpg, id=3, 401.5pt x 301.125pt>
File: example-image-a.jpg Graphic file (type jpg)
<use example-image-a.jpg>
Package pdftex.def Info: example-image-a.jpg  used on input line 18.
(pdftex.def)             Requested size: 401.49901pt x 301.12425pt.
[1

 <C:/Users/Steven/AppData/Local/Programs/MiKTeX 2.9/tex/latex/mwe/example-image
-a.pdf{C:/Users/Steven/AppData/Local/MiKTeX/2.9/pdftex/config/pdftex.map}> <C:/
Users/Steven/AppData/Local/Programs/MiKTeX 2.9/tex/latex/mwe/example-image-a.pn
g> <C:/Users/Steven/AppData/Local/Programs/MiKTeX 2.9/tex/latex/mwe/example-ima
ge-a.jpg>] (junk.aux) ) 
Here is how much of TeX's memory you used:
 1891 strings out of 479321
 31689 string characters out of 2854162
 316567 words of memory out of 3000000
 19358 multiletter control sequences out of 15000+600000
 403430 words of font info for 27 fonts, out of 8000000 for 9000
 1141 hyphenation exceptions out of 8191
 68i,5n,74p,207b,170s stack positions out of 5000i,500n,10000p,200000b,80000s
<C:/Users/Steven/AppData/Local/Programs/MiKTeX 2.9/fonts
/type1/public/lm/lmss17.pfb>
Output written on junk.pdf (1 page, 30241 bytes).
PDF statistics:
 16 PDF objects out of 1000 (max. 8388607)
 0 named destinations out of 1000 (max. 500000)
 16 words of extra memory for PDF output out of 10000 (max. 10000000)

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP