Rounded corners for a background image
Here is my MWE taken from here:
documentclass[varwidth]{standalone}
usepackage{ eso-pic,tikz, lipsum}
usetikzlibrary{tikzmark}
linespread{2}
newcommandBackgroundPic{%
begin{tikzpicture}[overlay,remember picture]
node[anchor=north west,inner sep=0pt, rounded corners=10pt] at ([yshift=8pt]pic cs:start) {%
includegraphics[width=textwidth]{example-image}};
end{tikzpicture}}
begin{document}
AddToShipoutPicture*{BackgroundPic}
tikzmark{start}lipsum[1-1]tikzmark{end}
end{document}
I would like the background image to be with rounded corners. But it does not work.
How do I get the background image with rounded corners?
tikz-pgf graphics backgrounds rounded-corners
add a comment |
Here is my MWE taken from here:
documentclass[varwidth]{standalone}
usepackage{ eso-pic,tikz, lipsum}
usetikzlibrary{tikzmark}
linespread{2}
newcommandBackgroundPic{%
begin{tikzpicture}[overlay,remember picture]
node[anchor=north west,inner sep=0pt, rounded corners=10pt] at ([yshift=8pt]pic cs:start) {%
includegraphics[width=textwidth]{example-image}};
end{tikzpicture}}
begin{document}
AddToShipoutPicture*{BackgroundPic}
tikzmark{start}lipsum[1-1]tikzmark{end}
end{document}
I would like the background image to be with rounded corners. But it does not work.
How do I get the background image with rounded corners?
tikz-pgf graphics backgrounds rounded-corners
add a comment |
Here is my MWE taken from here:
documentclass[varwidth]{standalone}
usepackage{ eso-pic,tikz, lipsum}
usetikzlibrary{tikzmark}
linespread{2}
newcommandBackgroundPic{%
begin{tikzpicture}[overlay,remember picture]
node[anchor=north west,inner sep=0pt, rounded corners=10pt] at ([yshift=8pt]pic cs:start) {%
includegraphics[width=textwidth]{example-image}};
end{tikzpicture}}
begin{document}
AddToShipoutPicture*{BackgroundPic}
tikzmark{start}lipsum[1-1]tikzmark{end}
end{document}
I would like the background image to be with rounded corners. But it does not work.
How do I get the background image with rounded corners?
tikz-pgf graphics backgrounds rounded-corners
Here is my MWE taken from here:
documentclass[varwidth]{standalone}
usepackage{ eso-pic,tikz, lipsum}
usetikzlibrary{tikzmark}
linespread{2}
newcommandBackgroundPic{%
begin{tikzpicture}[overlay,remember picture]
node[anchor=north west,inner sep=0pt, rounded corners=10pt] at ([yshift=8pt]pic cs:start) {%
includegraphics[width=textwidth]{example-image}};
end{tikzpicture}}
begin{document}
AddToShipoutPicture*{BackgroundPic}
tikzmark{start}lipsum[1-1]tikzmark{end}
end{document}
I would like the background image to be with rounded corners. But it does not work.
How do I get the background image with rounded corners?
tikz-pgf graphics backgrounds rounded-corners
tikz-pgf graphics backgrounds rounded-corners
asked Dec 9 at 9:23
deshmukh
1,0381326
1,0381326
add a comment |
add a comment |
2 Answers
2
active
oldest
votes
Another solution with tcolorbox. As blankest option suppresses rounded corners, its effects have been simulated with boxsep=0t and other geometry parameters.
documentclass[tikz, border=2mm]{standalone}
usepackage{graphicx, lipsum}
usepackage[most]{tcolorbox}
newtcolorbox{myminipage}[3]{
enhanced,
% blankest,
% rounded corners,
boxsep=0pt,
left=0pt,
right=0pt,
top=0pt,
bottom=0pt,
width=#2,
underlay={begin{tcbclipframe}
node at (frame) {includegraphics{#3}};
end{tcbclipframe}},
#1
}
begin{document}
begin{myminipage}{3cm}{example-image}
This is some text not so long like texttt{textbackslash{}lipsum[2]}
end{myminipage}
begin{myminipage}{10cm}{example-image}
lipsum[2]
end{myminipage}
end{document}

add a comment |
Use clip along with rounded corners while including image.

documentclass[varwidth,border=10pt]{standalone}
usepackage{calc}
usepackage{ eso-pic,tikz, lipsum}
usetikzlibrary{tikzmark}
linespread{2}
newcommandBackgroundPic{%
begin{tikzpicture}[overlay,remember picture]
node[anchor=north west,inner sep=0pt, clip, rounded corners=20pt] at ([yshift=15pt,xshift=-5pt]pic cs:start) {%
includegraphics[width=textwidth+10pt]{example-image}};
end{tikzpicture}}
begin{document}
AddToShipoutPicture*{BackgroundPic}
tikzmark{start}lipsum[1-1]tikzmark{end}
end{document}
Thanks. This is almost there. But part of the text goes outside. Is there a way to ensure that the text remains strictly inside the image?
– deshmukh
Dec 9 at 12:26
@deshmukh It is because the image height is less than that of the text. Either an image with height matching with text has to be used or the current image has to be stretched/zoomed.
– nidhin
Dec 9 at 12:33
@deshmukh you can mentionheight=along withwidth=inincludegraphics. But this can alter the aspect ratio.
– nidhin
Dec 9 at 12:40
No, I tried with a very large image 744*1052 and text does go outside the rounded corners
– deshmukh
Dec 9 at 12:41
1
Thanks. This works perfectly. I accepted the other answer, however, as it was more succinct.
– deshmukh
Dec 14 at 12:10
|
show 3 more comments
Your Answer
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "85"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: false,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2ftex.stackexchange.com%2fquestions%2f463913%2frounded-corners-for-a-background-image%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
2 Answers
2
active
oldest
votes
2 Answers
2
active
oldest
votes
active
oldest
votes
active
oldest
votes
Another solution with tcolorbox. As blankest option suppresses rounded corners, its effects have been simulated with boxsep=0t and other geometry parameters.
documentclass[tikz, border=2mm]{standalone}
usepackage{graphicx, lipsum}
usepackage[most]{tcolorbox}
newtcolorbox{myminipage}[3]{
enhanced,
% blankest,
% rounded corners,
boxsep=0pt,
left=0pt,
right=0pt,
top=0pt,
bottom=0pt,
width=#2,
underlay={begin{tcbclipframe}
node at (frame) {includegraphics{#3}};
end{tcbclipframe}},
#1
}
begin{document}
begin{myminipage}{3cm}{example-image}
This is some text not so long like texttt{textbackslash{}lipsum[2]}
end{myminipage}
begin{myminipage}{10cm}{example-image}
lipsum[2]
end{myminipage}
end{document}

add a comment |
Another solution with tcolorbox. As blankest option suppresses rounded corners, its effects have been simulated with boxsep=0t and other geometry parameters.
documentclass[tikz, border=2mm]{standalone}
usepackage{graphicx, lipsum}
usepackage[most]{tcolorbox}
newtcolorbox{myminipage}[3]{
enhanced,
% blankest,
% rounded corners,
boxsep=0pt,
left=0pt,
right=0pt,
top=0pt,
bottom=0pt,
width=#2,
underlay={begin{tcbclipframe}
node at (frame) {includegraphics{#3}};
end{tcbclipframe}},
#1
}
begin{document}
begin{myminipage}{3cm}{example-image}
This is some text not so long like texttt{textbackslash{}lipsum[2]}
end{myminipage}
begin{myminipage}{10cm}{example-image}
lipsum[2]
end{myminipage}
end{document}

add a comment |
Another solution with tcolorbox. As blankest option suppresses rounded corners, its effects have been simulated with boxsep=0t and other geometry parameters.
documentclass[tikz, border=2mm]{standalone}
usepackage{graphicx, lipsum}
usepackage[most]{tcolorbox}
newtcolorbox{myminipage}[3]{
enhanced,
% blankest,
% rounded corners,
boxsep=0pt,
left=0pt,
right=0pt,
top=0pt,
bottom=0pt,
width=#2,
underlay={begin{tcbclipframe}
node at (frame) {includegraphics{#3}};
end{tcbclipframe}},
#1
}
begin{document}
begin{myminipage}{3cm}{example-image}
This is some text not so long like texttt{textbackslash{}lipsum[2]}
end{myminipage}
begin{myminipage}{10cm}{example-image}
lipsum[2]
end{myminipage}
end{document}

Another solution with tcolorbox. As blankest option suppresses rounded corners, its effects have been simulated with boxsep=0t and other geometry parameters.
documentclass[tikz, border=2mm]{standalone}
usepackage{graphicx, lipsum}
usepackage[most]{tcolorbox}
newtcolorbox{myminipage}[3]{
enhanced,
% blankest,
% rounded corners,
boxsep=0pt,
left=0pt,
right=0pt,
top=0pt,
bottom=0pt,
width=#2,
underlay={begin{tcbclipframe}
node at (frame) {includegraphics{#3}};
end{tcbclipframe}},
#1
}
begin{document}
begin{myminipage}{3cm}{example-image}
This is some text not so long like texttt{textbackslash{}lipsum[2]}
end{myminipage}
begin{myminipage}{10cm}{example-image}
lipsum[2]
end{myminipage}
end{document}

answered Dec 12 at 10:03
Ignasi
91.5k4165303
91.5k4165303
add a comment |
add a comment |
Use clip along with rounded corners while including image.

documentclass[varwidth,border=10pt]{standalone}
usepackage{calc}
usepackage{ eso-pic,tikz, lipsum}
usetikzlibrary{tikzmark}
linespread{2}
newcommandBackgroundPic{%
begin{tikzpicture}[overlay,remember picture]
node[anchor=north west,inner sep=0pt, clip, rounded corners=20pt] at ([yshift=15pt,xshift=-5pt]pic cs:start) {%
includegraphics[width=textwidth+10pt]{example-image}};
end{tikzpicture}}
begin{document}
AddToShipoutPicture*{BackgroundPic}
tikzmark{start}lipsum[1-1]tikzmark{end}
end{document}
Thanks. This is almost there. But part of the text goes outside. Is there a way to ensure that the text remains strictly inside the image?
– deshmukh
Dec 9 at 12:26
@deshmukh It is because the image height is less than that of the text. Either an image with height matching with text has to be used or the current image has to be stretched/zoomed.
– nidhin
Dec 9 at 12:33
@deshmukh you can mentionheight=along withwidth=inincludegraphics. But this can alter the aspect ratio.
– nidhin
Dec 9 at 12:40
No, I tried with a very large image 744*1052 and text does go outside the rounded corners
– deshmukh
Dec 9 at 12:41
1
Thanks. This works perfectly. I accepted the other answer, however, as it was more succinct.
– deshmukh
Dec 14 at 12:10
|
show 3 more comments
Use clip along with rounded corners while including image.

documentclass[varwidth,border=10pt]{standalone}
usepackage{calc}
usepackage{ eso-pic,tikz, lipsum}
usetikzlibrary{tikzmark}
linespread{2}
newcommandBackgroundPic{%
begin{tikzpicture}[overlay,remember picture]
node[anchor=north west,inner sep=0pt, clip, rounded corners=20pt] at ([yshift=15pt,xshift=-5pt]pic cs:start) {%
includegraphics[width=textwidth+10pt]{example-image}};
end{tikzpicture}}
begin{document}
AddToShipoutPicture*{BackgroundPic}
tikzmark{start}lipsum[1-1]tikzmark{end}
end{document}
Thanks. This is almost there. But part of the text goes outside. Is there a way to ensure that the text remains strictly inside the image?
– deshmukh
Dec 9 at 12:26
@deshmukh It is because the image height is less than that of the text. Either an image with height matching with text has to be used or the current image has to be stretched/zoomed.
– nidhin
Dec 9 at 12:33
@deshmukh you can mentionheight=along withwidth=inincludegraphics. But this can alter the aspect ratio.
– nidhin
Dec 9 at 12:40
No, I tried with a very large image 744*1052 and text does go outside the rounded corners
– deshmukh
Dec 9 at 12:41
1
Thanks. This works perfectly. I accepted the other answer, however, as it was more succinct.
– deshmukh
Dec 14 at 12:10
|
show 3 more comments
Use clip along with rounded corners while including image.

documentclass[varwidth,border=10pt]{standalone}
usepackage{calc}
usepackage{ eso-pic,tikz, lipsum}
usetikzlibrary{tikzmark}
linespread{2}
newcommandBackgroundPic{%
begin{tikzpicture}[overlay,remember picture]
node[anchor=north west,inner sep=0pt, clip, rounded corners=20pt] at ([yshift=15pt,xshift=-5pt]pic cs:start) {%
includegraphics[width=textwidth+10pt]{example-image}};
end{tikzpicture}}
begin{document}
AddToShipoutPicture*{BackgroundPic}
tikzmark{start}lipsum[1-1]tikzmark{end}
end{document}
Use clip along with rounded corners while including image.

documentclass[varwidth,border=10pt]{standalone}
usepackage{calc}
usepackage{ eso-pic,tikz, lipsum}
usetikzlibrary{tikzmark}
linespread{2}
newcommandBackgroundPic{%
begin{tikzpicture}[overlay,remember picture]
node[anchor=north west,inner sep=0pt, clip, rounded corners=20pt] at ([yshift=15pt,xshift=-5pt]pic cs:start) {%
includegraphics[width=textwidth+10pt]{example-image}};
end{tikzpicture}}
begin{document}
AddToShipoutPicture*{BackgroundPic}
tikzmark{start}lipsum[1-1]tikzmark{end}
end{document}
edited Dec 9 at 14:01
answered Dec 9 at 9:41
nidhin
3,342927
3,342927
Thanks. This is almost there. But part of the text goes outside. Is there a way to ensure that the text remains strictly inside the image?
– deshmukh
Dec 9 at 12:26
@deshmukh It is because the image height is less than that of the text. Either an image with height matching with text has to be used or the current image has to be stretched/zoomed.
– nidhin
Dec 9 at 12:33
@deshmukh you can mentionheight=along withwidth=inincludegraphics. But this can alter the aspect ratio.
– nidhin
Dec 9 at 12:40
No, I tried with a very large image 744*1052 and text does go outside the rounded corners
– deshmukh
Dec 9 at 12:41
1
Thanks. This works perfectly. I accepted the other answer, however, as it was more succinct.
– deshmukh
Dec 14 at 12:10
|
show 3 more comments
Thanks. This is almost there. But part of the text goes outside. Is there a way to ensure that the text remains strictly inside the image?
– deshmukh
Dec 9 at 12:26
@deshmukh It is because the image height is less than that of the text. Either an image with height matching with text has to be used or the current image has to be stretched/zoomed.
– nidhin
Dec 9 at 12:33
@deshmukh you can mentionheight=along withwidth=inincludegraphics. But this can alter the aspect ratio.
– nidhin
Dec 9 at 12:40
No, I tried with a very large image 744*1052 and text does go outside the rounded corners
– deshmukh
Dec 9 at 12:41
1
Thanks. This works perfectly. I accepted the other answer, however, as it was more succinct.
– deshmukh
Dec 14 at 12:10
Thanks. This is almost there. But part of the text goes outside. Is there a way to ensure that the text remains strictly inside the image?
– deshmukh
Dec 9 at 12:26
Thanks. This is almost there. But part of the text goes outside. Is there a way to ensure that the text remains strictly inside the image?
– deshmukh
Dec 9 at 12:26
@deshmukh It is because the image height is less than that of the text. Either an image with height matching with text has to be used or the current image has to be stretched/zoomed.
– nidhin
Dec 9 at 12:33
@deshmukh It is because the image height is less than that of the text. Either an image with height matching with text has to be used or the current image has to be stretched/zoomed.
– nidhin
Dec 9 at 12:33
@deshmukh you can mention
height= along with width= in includegraphics. But this can alter the aspect ratio.– nidhin
Dec 9 at 12:40
@deshmukh you can mention
height= along with width= in includegraphics. But this can alter the aspect ratio.– nidhin
Dec 9 at 12:40
No, I tried with a very large image 744*1052 and text does go outside the rounded corners
– deshmukh
Dec 9 at 12:41
No, I tried with a very large image 744*1052 and text does go outside the rounded corners
– deshmukh
Dec 9 at 12:41
1
1
Thanks. This works perfectly. I accepted the other answer, however, as it was more succinct.
– deshmukh
Dec 14 at 12:10
Thanks. This works perfectly. I accepted the other answer, however, as it was more succinct.
– deshmukh
Dec 14 at 12:10
|
show 3 more comments
Thanks for contributing an answer to TeX - LaTeX Stack Exchange!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Some of your past answers have not been well-received, and you're in danger of being blocked from answering.
Please pay close attention to the following guidance:
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2ftex.stackexchange.com%2fquestions%2f463913%2frounded-corners-for-a-background-image%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown