Background
Looking to make a background image scale to fill an entire page.
Code
I tried changing the dimensions of the page to fill the entire area and then drop in an external image:
\setuplayout[
backspace=0mm,
leftmargin=0mm,
rightmargin=0mm,
topdistance=0mm,
header=0mm,
footer=0mm,
]
\starttext
\startfrontmatter
% Title page (front cover).
\startstandardmakeup
% Front Cover Photo
% Front Cover Photo citation (author, author url, license, license url)
\externalfigure[cover.png][width=\paperwidth,height=\paperheight]
\stopstandardmakeup
% Copyright page.
\startstandardmakeup
% date
% author
Copyright
\stopstandardmakeup
% Table of Contents.
\completecontent
\stopfrontmatter
\stoptext
Update
Other attempts that don't quite work.
Layer
Using a defined layer:
\definelayer[cover][
x=0mm,
y=0mm,
width=\paperwidth,
height=\paperheight,
]
\setlayer[cover][
hoffset=0mm,
voffset=0mm,
]{%
\framed[
frame=off
width=\paperwidth,
height=\paperheight,
]{%
\externalfigure[cover.png][width=\paperwidth,height=\paperheight]
}
}
\starttext
\startfrontmatter
\setupbackgrounds[page][background=cover]
\startstandardmakeup
\stopstandardmakeup
\setupbackground[page][background=]
\stopfrontmatter
\stoptext
This produces a white border along the left and bottom edges:
Problem
There is a small amount of whitespace that is not taken up by the image:
Related
The wiki shows how to fill a page using an MP graphic, but that seems to be overly complicated for just adding an image to the page:
The question on filling the background graphic across two pages is similar, but has text on top of the image:
Additional Information
External figures are set up as follows:
\setupexternalfigures[
order={svg,pdf,png,jpg},
location=global,
width=\hsize,
]
Question
What is the proper way to scale an image, without respecting its aspect ratio, such that it fills the entire page?
\framed
inside the layer. Simply use\setlayer[cover]{\externalfigure[cover.png][width=..., height=...]}
(with no whitespace after]
of\externalfigure
)\setupexternalfigures[factor=fit]
somewhere in your code? If so, you could try using\externalfigure[...][... factor=]
.