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?










share|improve this question




























    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?










    share|improve this question


























      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?










      share|improve this question















      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






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited 1 hour ago

























      asked 2 hours ago









      deshmukh

      1,0141326




      1,0141326






















          1 Answer
          1






          active

          oldest

          votes

















          up vote
          1
          down vote













          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}


          enter image description here



          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}


          enter image description here






          share|improve this answer























          • Thanks. But is not the page much larger than the text needs it to be?
            – deshmukh
            2 hours ago










          • Also, I found solution to part of the problem. I will modify the question to reflect it.
            – deshmukh
            2 hours ago










          • 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
            2 hours ago










          • Yes. I still have a question. The image is scaling. I wish I could crop it from, say, top left
            – deshmukh
            1 hour ago










          • @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
            1 hour ago











          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
          });


          }
          });














          draft saved

          draft discarded


















          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

























          1 Answer
          1






          active

          oldest

          votes








          1 Answer
          1






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes








          up vote
          1
          down vote













          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}


          enter image description here



          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}


          enter image description here






          share|improve this answer























          • Thanks. But is not the page much larger than the text needs it to be?
            – deshmukh
            2 hours ago










          • Also, I found solution to part of the problem. I will modify the question to reflect it.
            – deshmukh
            2 hours ago










          • 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
            2 hours ago










          • Yes. I still have a question. The image is scaling. I wish I could crop it from, say, top left
            – deshmukh
            1 hour ago










          • @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
            1 hour ago















          up vote
          1
          down vote













          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}


          enter image description here



          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}


          enter image description here






          share|improve this answer























          • Thanks. But is not the page much larger than the text needs it to be?
            – deshmukh
            2 hours ago










          • Also, I found solution to part of the problem. I will modify the question to reflect it.
            – deshmukh
            2 hours ago










          • 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
            2 hours ago










          • Yes. I still have a question. The image is scaling. I wish I could crop it from, say, top left
            – deshmukh
            1 hour ago










          • @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
            1 hour ago













          up vote
          1
          down vote










          up vote
          1
          down vote









          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}


          enter image description here



          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}


          enter image description here






          share|improve this answer














          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}


          enter image description here



          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}


          enter image description here







          share|improve this answer














          share|improve this answer



          share|improve this answer








          edited 1 hour ago

























          answered 2 hours ago









          marmot

          80.4k491172




          80.4k491172












          • Thanks. But is not the page much larger than the text needs it to be?
            – deshmukh
            2 hours ago










          • Also, I found solution to part of the problem. I will modify the question to reflect it.
            – deshmukh
            2 hours ago










          • 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
            2 hours ago










          • Yes. I still have a question. The image is scaling. I wish I could crop it from, say, top left
            – deshmukh
            1 hour ago










          • @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
            1 hour ago


















          • Thanks. But is not the page much larger than the text needs it to be?
            – deshmukh
            2 hours ago










          • Also, I found solution to part of the problem. I will modify the question to reflect it.
            – deshmukh
            2 hours ago










          • 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
            2 hours ago










          • Yes. I still have a question. The image is scaling. I wish I could crop it from, say, top left
            – deshmukh
            1 hour ago










          • @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
            1 hour ago
















          Thanks. But is not the page much larger than the text needs it to be?
          – deshmukh
          2 hours ago




          Thanks. But is not the page much larger than the text needs it to be?
          – deshmukh
          2 hours ago












          Also, I found solution to part of the problem. I will modify the question to reflect it.
          – deshmukh
          2 hours ago




          Also, I found solution to part of the problem. I will modify the question to reflect it.
          – deshmukh
          2 hours ago












          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
          2 hours ago




          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
          2 hours ago












          Yes. I still have a question. The image is scaling. I wish I could crop it from, say, top left
          – deshmukh
          1 hour ago




          Yes. I still have a question. The image is scaling. I wish I could crop it from, say, top left
          – deshmukh
          1 hour ago












          @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
          1 hour ago




          @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
          1 hour ago


















          draft saved

          draft discarded




















































          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.




          draft saved


          draft discarded














          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





















































          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







          Popular posts from this blog

          サソリ

          広島県道265号伴広島線

          Accessing regular linux commands in Huawei's Dopra Linux