Rounded corners for a background image












4














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?










share|improve this question



























    4














    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?










    share|improve this question

























      4












      4








      4







      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?










      share|improve this question













      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






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked Dec 9 at 9:23









      deshmukh

      1,0381326




      1,0381326






















          2 Answers
          2






          active

          oldest

          votes


















          2














          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}


          enter image description here






          share|improve this answer





























            5














            Use clip along with rounded corners while including image.



            enter image description here



            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}





            share|improve this answer























            • 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 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






            • 1




              Thanks. This works perfectly. I accepted the other answer, however, as it was more succinct.
              – deshmukh
              Dec 14 at 12:10











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


            }
            });














            draft saved

            draft discarded


















            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









            2














            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}


            enter image description here






            share|improve this answer


























              2














              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}


              enter image description here






              share|improve this answer
























                2












                2








                2






                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}


                enter image description here






                share|improve this answer












                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}


                enter image description here







                share|improve this answer












                share|improve this answer



                share|improve this answer










                answered Dec 12 at 10:03









                Ignasi

                91.5k4165303




                91.5k4165303























                    5














                    Use clip along with rounded corners while including image.



                    enter image description here



                    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}





                    share|improve this answer























                    • 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 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






                    • 1




                      Thanks. This works perfectly. I accepted the other answer, however, as it was more succinct.
                      – deshmukh
                      Dec 14 at 12:10
















                    5














                    Use clip along with rounded corners while including image.



                    enter image description here



                    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}





                    share|improve this answer























                    • 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 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






                    • 1




                      Thanks. This works perfectly. I accepted the other answer, however, as it was more succinct.
                      – deshmukh
                      Dec 14 at 12:10














                    5












                    5








                    5






                    Use clip along with rounded corners while including image.



                    enter image description here



                    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}





                    share|improve this answer














                    Use clip along with rounded corners while including image.



                    enter image description here



                    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}






                    share|improve this answer














                    share|improve this answer



                    share|improve this answer








                    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 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






                    • 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










                    • @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










                    • 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


















                    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%2f463913%2frounded-corners-for-a-background-image%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

                    Paul Cézanne

                    UIScrollView CustomStickyHeader Resize height generates problems when scroll is too fast

                    Angular material date-picker (MatDatepicker) auto completes the date on focus out