Crop, not scale, the background image and produce an image instead of a pdf
up vote
2
down vote
favorite
Here is my MWE:
documentclass{standalone}
usepackage{graphicx, lipsum}
usepackage[most]{tcolorbox}
newtcolorbox{myminipage}[3]{
breakable,
blankest,
watermark graphics=#3,
watermark stretch=1,
width=#2,
#1
}
begin{document}
begin{myminipage}{3cm}{example-image}
lipsum[2]
end{myminipage}
end{document}
This is taken from here.
The background image scales. Can it be cropped, instead?
And lastly, will it be possible to produce a jpeg or png directly?
graphics crop export
add a comment |
up vote
2
down vote
favorite
Here is my MWE:
documentclass{standalone}
usepackage{graphicx, lipsum}
usepackage[most]{tcolorbox}
newtcolorbox{myminipage}[3]{
breakable,
blankest,
watermark graphics=#3,
watermark stretch=1,
width=#2,
#1
}
begin{document}
begin{myminipage}{3cm}{example-image}
lipsum[2]
end{myminipage}
end{document}
This is taken from here.
The background image scales. Can it be cropped, instead?
And lastly, will it be possible to produce a jpeg or png directly?
graphics crop export
add a comment |
up vote
2
down vote
favorite
up vote
2
down vote
favorite
Here is my MWE:
documentclass{standalone}
usepackage{graphicx, lipsum}
usepackage[most]{tcolorbox}
newtcolorbox{myminipage}[3]{
breakable,
blankest,
watermark graphics=#3,
watermark stretch=1,
width=#2,
#1
}
begin{document}
begin{myminipage}{3cm}{example-image}
lipsum[2]
end{myminipage}
end{document}
This is taken from here.
The background image scales. Can it be cropped, instead?
And lastly, will it be possible to produce a jpeg or png directly?
graphics crop export
Here is my MWE:
documentclass{standalone}
usepackage{graphicx, lipsum}
usepackage[most]{tcolorbox}
newtcolorbox{myminipage}[3]{
breakable,
blankest,
watermark graphics=#3,
watermark stretch=1,
width=#2,
#1
}
begin{document}
begin{myminipage}{3cm}{example-image}
lipsum[2]
end{myminipage}
end{document}
This is taken from here.
The background image scales. Can it be cropped, instead?
And lastly, will it be possible to produce a jpeg or png directly?
graphics crop export
graphics crop export
edited Dec 4 at 2:58
asked Dec 4 at 1:48
deshmukh
1,0361326
1,0361326
add a comment |
add a comment |
1 Answer
1
active
oldest
votes
up vote
2
down vote
accepted
Are you looking for the standalone
class with the varwidth
option?
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] at ([yshift=8pt]pic cs:start) {%
includegraphics[width=textwidth]{example-image}};
end{tikzpicture}}
begin{document}
AddToShipoutPicture*{BackgroundPic}
tikzmark{start}lipsum[1-1]
end{document}
OLDER VERSIONS: tikzpagenodes
allows you to precisely determined the text area.
documentclass{article}
usepackage{geometry, eso-pic, tikzpagenodes, lipsum}
linespread{2}
newcommandBackgroundPic{%
begin{tikzpicture}[overlay,remember picture]
node[anchor=north west,inner sep=0pt] at (current page text area.north west) {
includegraphics[width=textwidth,height=textheight,%
]{example-image}};
end{tikzpicture}}
geometry{
a4paper,
portrait,
margin=1in,
top=.25in,
bottom=1.75in
}
begin{document}
AddToShipoutPicture*{BackgroundPic}
thispagestyle{empty}
lipsum[1-1]
end{document}
Here is something that crops the image against the text...
documentclass{article}
usepackage{geometry, eso-pic, tikzpagenodes, lipsum}
usetikzlibrary{tikzmark}
linespread{2}
newcommandBackgroundPic{%
begin{tikzpicture}[overlay,remember picture]
path ([yshift=12pt]pic cs:start) coordinate(aux1) ([yshift=-3pt]pic cs:end) coordinate(aux2);
clip (current page text area.west |-aux1) rectangle
(current page text area.east |-aux2);
node[anchor=north west,inner sep=0pt] at (current page text area.north west) {%
includegraphics[width=textwidth]{example-image}};
end{tikzpicture}}
geometry{
a4paper,
portrait,
margin=1in,
top=.25in,
bottom=1.75in
}
begin{document}
AddToShipoutPicture*{BackgroundPic}
thispagestyle{empty}
tikzmark{start}lipsum[1-1]tikzmark{end}
end{document}
Thanks. But is not the page much larger than the text needs it to be?
– deshmukh
Dec 4 at 2:04
Also, I found solution to part of the problem. I will modify the question to reflect it.
– deshmukh
Dec 4 at 2:05
Yes, I think a tcolorbox is a possible solution to the updated question. Do you actually still have a question? (With tikzmark one could cook up something that is truly on the background and does not influence the text, at least as long as there is no page break. I am also not saying that tikzmark is the only or the "best" possible way.)
– marmot
Dec 4 at 2:39
Yes. I still have a question. The image is scaling. I wish I could crop it from, say, top left
– deshmukh
Dec 4 at 2:57
@deshmukh Could you please explain what "crop it from, say, top left " means? Does that mean you want no longer adjust the size of the image but literally crop it?
– marmot
Dec 4 at 3:14
|
show 5 more comments
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
2
down vote
accepted
Are you looking for the standalone
class with the varwidth
option?
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] at ([yshift=8pt]pic cs:start) {%
includegraphics[width=textwidth]{example-image}};
end{tikzpicture}}
begin{document}
AddToShipoutPicture*{BackgroundPic}
tikzmark{start}lipsum[1-1]
end{document}
OLDER VERSIONS: tikzpagenodes
allows you to precisely determined the text area.
documentclass{article}
usepackage{geometry, eso-pic, tikzpagenodes, lipsum}
linespread{2}
newcommandBackgroundPic{%
begin{tikzpicture}[overlay,remember picture]
node[anchor=north west,inner sep=0pt] at (current page text area.north west) {
includegraphics[width=textwidth,height=textheight,%
]{example-image}};
end{tikzpicture}}
geometry{
a4paper,
portrait,
margin=1in,
top=.25in,
bottom=1.75in
}
begin{document}
AddToShipoutPicture*{BackgroundPic}
thispagestyle{empty}
lipsum[1-1]
end{document}
Here is something that crops the image against the text...
documentclass{article}
usepackage{geometry, eso-pic, tikzpagenodes, lipsum}
usetikzlibrary{tikzmark}
linespread{2}
newcommandBackgroundPic{%
begin{tikzpicture}[overlay,remember picture]
path ([yshift=12pt]pic cs:start) coordinate(aux1) ([yshift=-3pt]pic cs:end) coordinate(aux2);
clip (current page text area.west |-aux1) rectangle
(current page text area.east |-aux2);
node[anchor=north west,inner sep=0pt] at (current page text area.north west) {%
includegraphics[width=textwidth]{example-image}};
end{tikzpicture}}
geometry{
a4paper,
portrait,
margin=1in,
top=.25in,
bottom=1.75in
}
begin{document}
AddToShipoutPicture*{BackgroundPic}
thispagestyle{empty}
tikzmark{start}lipsum[1-1]tikzmark{end}
end{document}
Thanks. But is not the page much larger than the text needs it to be?
– deshmukh
Dec 4 at 2:04
Also, I found solution to part of the problem. I will modify the question to reflect it.
– deshmukh
Dec 4 at 2:05
Yes, I think a tcolorbox is a possible solution to the updated question. Do you actually still have a question? (With tikzmark one could cook up something that is truly on the background and does not influence the text, at least as long as there is no page break. I am also not saying that tikzmark is the only or the "best" possible way.)
– marmot
Dec 4 at 2:39
Yes. I still have a question. The image is scaling. I wish I could crop it from, say, top left
– deshmukh
Dec 4 at 2:57
@deshmukh Could you please explain what "crop it from, say, top left " means? Does that mean you want no longer adjust the size of the image but literally crop it?
– marmot
Dec 4 at 3:14
|
show 5 more comments
up vote
2
down vote
accepted
Are you looking for the standalone
class with the varwidth
option?
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] at ([yshift=8pt]pic cs:start) {%
includegraphics[width=textwidth]{example-image}};
end{tikzpicture}}
begin{document}
AddToShipoutPicture*{BackgroundPic}
tikzmark{start}lipsum[1-1]
end{document}
OLDER VERSIONS: tikzpagenodes
allows you to precisely determined the text area.
documentclass{article}
usepackage{geometry, eso-pic, tikzpagenodes, lipsum}
linespread{2}
newcommandBackgroundPic{%
begin{tikzpicture}[overlay,remember picture]
node[anchor=north west,inner sep=0pt] at (current page text area.north west) {
includegraphics[width=textwidth,height=textheight,%
]{example-image}};
end{tikzpicture}}
geometry{
a4paper,
portrait,
margin=1in,
top=.25in,
bottom=1.75in
}
begin{document}
AddToShipoutPicture*{BackgroundPic}
thispagestyle{empty}
lipsum[1-1]
end{document}
Here is something that crops the image against the text...
documentclass{article}
usepackage{geometry, eso-pic, tikzpagenodes, lipsum}
usetikzlibrary{tikzmark}
linespread{2}
newcommandBackgroundPic{%
begin{tikzpicture}[overlay,remember picture]
path ([yshift=12pt]pic cs:start) coordinate(aux1) ([yshift=-3pt]pic cs:end) coordinate(aux2);
clip (current page text area.west |-aux1) rectangle
(current page text area.east |-aux2);
node[anchor=north west,inner sep=0pt] at (current page text area.north west) {%
includegraphics[width=textwidth]{example-image}};
end{tikzpicture}}
geometry{
a4paper,
portrait,
margin=1in,
top=.25in,
bottom=1.75in
}
begin{document}
AddToShipoutPicture*{BackgroundPic}
thispagestyle{empty}
tikzmark{start}lipsum[1-1]tikzmark{end}
end{document}
Thanks. But is not the page much larger than the text needs it to be?
– deshmukh
Dec 4 at 2:04
Also, I found solution to part of the problem. I will modify the question to reflect it.
– deshmukh
Dec 4 at 2:05
Yes, I think a tcolorbox is a possible solution to the updated question. Do you actually still have a question? (With tikzmark one could cook up something that is truly on the background and does not influence the text, at least as long as there is no page break. I am also not saying that tikzmark is the only or the "best" possible way.)
– marmot
Dec 4 at 2:39
Yes. I still have a question. The image is scaling. I wish I could crop it from, say, top left
– deshmukh
Dec 4 at 2:57
@deshmukh Could you please explain what "crop it from, say, top left " means? Does that mean you want no longer adjust the size of the image but literally crop it?
– marmot
Dec 4 at 3:14
|
show 5 more comments
up vote
2
down vote
accepted
up vote
2
down vote
accepted
Are you looking for the standalone
class with the varwidth
option?
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] at ([yshift=8pt]pic cs:start) {%
includegraphics[width=textwidth]{example-image}};
end{tikzpicture}}
begin{document}
AddToShipoutPicture*{BackgroundPic}
tikzmark{start}lipsum[1-1]
end{document}
OLDER VERSIONS: tikzpagenodes
allows you to precisely determined the text area.
documentclass{article}
usepackage{geometry, eso-pic, tikzpagenodes, lipsum}
linespread{2}
newcommandBackgroundPic{%
begin{tikzpicture}[overlay,remember picture]
node[anchor=north west,inner sep=0pt] at (current page text area.north west) {
includegraphics[width=textwidth,height=textheight,%
]{example-image}};
end{tikzpicture}}
geometry{
a4paper,
portrait,
margin=1in,
top=.25in,
bottom=1.75in
}
begin{document}
AddToShipoutPicture*{BackgroundPic}
thispagestyle{empty}
lipsum[1-1]
end{document}
Here is something that crops the image against the text...
documentclass{article}
usepackage{geometry, eso-pic, tikzpagenodes, lipsum}
usetikzlibrary{tikzmark}
linespread{2}
newcommandBackgroundPic{%
begin{tikzpicture}[overlay,remember picture]
path ([yshift=12pt]pic cs:start) coordinate(aux1) ([yshift=-3pt]pic cs:end) coordinate(aux2);
clip (current page text area.west |-aux1) rectangle
(current page text area.east |-aux2);
node[anchor=north west,inner sep=0pt] at (current page text area.north west) {%
includegraphics[width=textwidth]{example-image}};
end{tikzpicture}}
geometry{
a4paper,
portrait,
margin=1in,
top=.25in,
bottom=1.75in
}
begin{document}
AddToShipoutPicture*{BackgroundPic}
thispagestyle{empty}
tikzmark{start}lipsum[1-1]tikzmark{end}
end{document}
Are you looking for the standalone
class with the varwidth
option?
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] at ([yshift=8pt]pic cs:start) {%
includegraphics[width=textwidth]{example-image}};
end{tikzpicture}}
begin{document}
AddToShipoutPicture*{BackgroundPic}
tikzmark{start}lipsum[1-1]
end{document}
OLDER VERSIONS: tikzpagenodes
allows you to precisely determined the text area.
documentclass{article}
usepackage{geometry, eso-pic, tikzpagenodes, lipsum}
linespread{2}
newcommandBackgroundPic{%
begin{tikzpicture}[overlay,remember picture]
node[anchor=north west,inner sep=0pt] at (current page text area.north west) {
includegraphics[width=textwidth,height=textheight,%
]{example-image}};
end{tikzpicture}}
geometry{
a4paper,
portrait,
margin=1in,
top=.25in,
bottom=1.75in
}
begin{document}
AddToShipoutPicture*{BackgroundPic}
thispagestyle{empty}
lipsum[1-1]
end{document}
Here is something that crops the image against the text...
documentclass{article}
usepackage{geometry, eso-pic, tikzpagenodes, lipsum}
usetikzlibrary{tikzmark}
linespread{2}
newcommandBackgroundPic{%
begin{tikzpicture}[overlay,remember picture]
path ([yshift=12pt]pic cs:start) coordinate(aux1) ([yshift=-3pt]pic cs:end) coordinate(aux2);
clip (current page text area.west |-aux1) rectangle
(current page text area.east |-aux2);
node[anchor=north west,inner sep=0pt] at (current page text area.north west) {%
includegraphics[width=textwidth]{example-image}};
end{tikzpicture}}
geometry{
a4paper,
portrait,
margin=1in,
top=.25in,
bottom=1.75in
}
begin{document}
AddToShipoutPicture*{BackgroundPic}
thispagestyle{empty}
tikzmark{start}lipsum[1-1]tikzmark{end}
end{document}
edited Dec 4 at 15:53
answered Dec 4 at 1:55
marmot
82.3k492175
82.3k492175
Thanks. But is not the page much larger than the text needs it to be?
– deshmukh
Dec 4 at 2:04
Also, I found solution to part of the problem. I will modify the question to reflect it.
– deshmukh
Dec 4 at 2:05
Yes, I think a tcolorbox is a possible solution to the updated question. Do you actually still have a question? (With tikzmark one could cook up something that is truly on the background and does not influence the text, at least as long as there is no page break. I am also not saying that tikzmark is the only or the "best" possible way.)
– marmot
Dec 4 at 2:39
Yes. I still have a question. The image is scaling. I wish I could crop it from, say, top left
– deshmukh
Dec 4 at 2:57
@deshmukh Could you please explain what "crop it from, say, top left " means? Does that mean you want no longer adjust the size of the image but literally crop it?
– marmot
Dec 4 at 3:14
|
show 5 more comments
Thanks. But is not the page much larger than the text needs it to be?
– deshmukh
Dec 4 at 2:04
Also, I found solution to part of the problem. I will modify the question to reflect it.
– deshmukh
Dec 4 at 2:05
Yes, I think a tcolorbox is a possible solution to the updated question. Do you actually still have a question? (With tikzmark one could cook up something that is truly on the background and does not influence the text, at least as long as there is no page break. I am also not saying that tikzmark is the only or the "best" possible way.)
– marmot
Dec 4 at 2:39
Yes. I still have a question. The image is scaling. I wish I could crop it from, say, top left
– deshmukh
Dec 4 at 2:57
@deshmukh Could you please explain what "crop it from, say, top left " means? Does that mean you want no longer adjust the size of the image but literally crop it?
– marmot
Dec 4 at 3:14
Thanks. But is not the page much larger than the text needs it to be?
– deshmukh
Dec 4 at 2:04
Thanks. But is not the page much larger than the text needs it to be?
– deshmukh
Dec 4 at 2:04
Also, I found solution to part of the problem. I will modify the question to reflect it.
– deshmukh
Dec 4 at 2:05
Also, I found solution to part of the problem. I will modify the question to reflect it.
– deshmukh
Dec 4 at 2:05
Yes, I think a tcolorbox is a possible solution to the updated question. Do you actually still have a question? (With tikzmark one could cook up something that is truly on the background and does not influence the text, at least as long as there is no page break. I am also not saying that tikzmark is the only or the "best" possible way.)
– marmot
Dec 4 at 2:39
Yes, I think a tcolorbox is a possible solution to the updated question. Do you actually still have a question? (With tikzmark one could cook up something that is truly on the background and does not influence the text, at least as long as there is no page break. I am also not saying that tikzmark is the only or the "best" possible way.)
– marmot
Dec 4 at 2:39
Yes. I still have a question. The image is scaling. I wish I could crop it from, say, top left
– deshmukh
Dec 4 at 2:57
Yes. I still have a question. The image is scaling. I wish I could crop it from, say, top left
– deshmukh
Dec 4 at 2:57
@deshmukh Could you please explain what "crop it from, say, top left " means? Does that mean you want no longer adjust the size of the image but literally crop it?
– marmot
Dec 4 at 3:14
@deshmukh Could you please explain what "crop it from, say, top left " means? Does that mean you want no longer adjust the size of the image but literally crop it?
– marmot
Dec 4 at 3:14
|
show 5 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%2f463075%2fcrop-not-scale-the-background-image-and-produce-an-image-instead-of-a-pdf%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