Rounded corners for a background image
up vote
4
down vote
favorite
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 |
up vote
4
down vote
favorite
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 |
up vote
4
down vote
favorite
up vote
4
down vote
favorite
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,0361326
1,0361326
add a comment |
add a comment |
2 Answers
2
active
oldest
votes
up vote
5
down vote
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
@deshmukh We are scaling the image such that the with is equal totextwidth
. So the image height with respect to its width matters not the absolute height. Try with another image having a height more than its width. Say 1052 *744 :)
– nidhin
Dec 9 at 12:47
|
show 2 more comments
up vote
1
down vote
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 |
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',
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
up vote
5
down vote
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
@deshmukh We are scaling the image such that the with is equal totextwidth
. So the image height with respect to its width matters not the absolute height. Try with another image having a height more than its width. Say 1052 *744 :)
– nidhin
Dec 9 at 12:47
|
show 2 more comments
up vote
5
down vote
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
@deshmukh We are scaling the image such that the with is equal totextwidth
. So the image height with respect to its width matters not the absolute height. Try with another image having a height more than its width. Say 1052 *744 :)
– nidhin
Dec 9 at 12:47
|
show 2 more comments
up vote
5
down vote
up vote
5
down vote
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,179927
3,179927
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
@deshmukh We are scaling the image such that the with is equal totextwidth
. So the image height with respect to its width matters not the absolute height. Try with another image having a height more than its width. Say 1052 *744 :)
– nidhin
Dec 9 at 12:47
|
show 2 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
@deshmukh We are scaling the image such that the with is equal totextwidth
. So the image height with respect to its width matters not the absolute height. Try with another image having a height more than its width. Say 1052 *744 :)
– nidhin
Dec 9 at 12:47
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
@deshmukh We are scaling the image such that the with is equal to
textwidth
. So the image height with respect to its width matters not the absolute height. Try with another image having a height more than its width. Say 1052 *744 :)– nidhin
Dec 9 at 12:47
@deshmukh We are scaling the image such that the with is equal to
textwidth
. So the image height with respect to its width matters not the absolute height. Try with another image having a height more than its width. Say 1052 *744 :)– nidhin
Dec 9 at 12:47
|
show 2 more comments
up vote
1
down vote
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 |
up vote
1
down vote
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 |
up vote
1
down vote
up vote
1
down vote
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 yesterday
Ignasi
90.9k4164303
90.9k4164303
add a comment |
add a comment |
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