tikz: clip image with rounded corners and border












3














I want to round corners of image and I want to have border around:



documentclass{article}
usepackage{tikz}
usetikzlibrary{shadows.blur,fadings}

tikzset{
photo/.style={ inner sep=1pt,clip,rounded corners=0.5cm }
}

begin{document}

begin{tikzpicture}
node[photo] at (0,0)
{includegraphics[width=110mm]{chipping-sparrow-wiki-commons-1900x855.jpg}};
end{tikzpicture}

bigskip

begin{tikzpicture}
node[photo,draw=red!80,thick] at (0,0)
{includegraphics[width=110mm]{chipping-sparrow-wiki-commons-1900x855.jpg}};
end{tikzpicture}

end{document}


The second tikzpicture gives me an error:
! Package tikz Error: Extra options not allowed for clipping path command..



And the result looks like this:(Image by DickDaniels, CC-BY-SA, from https://www.innonmillcreek.com/blog/2017/01/north-carolina-mountain-birds-chipping-sparrow.html)



I guess I could use path and node combination, but I don't know image size.



How can I get clipped image with border in this case?










share|improve this question



























    3














    I want to round corners of image and I want to have border around:



    documentclass{article}
    usepackage{tikz}
    usetikzlibrary{shadows.blur,fadings}

    tikzset{
    photo/.style={ inner sep=1pt,clip,rounded corners=0.5cm }
    }

    begin{document}

    begin{tikzpicture}
    node[photo] at (0,0)
    {includegraphics[width=110mm]{chipping-sparrow-wiki-commons-1900x855.jpg}};
    end{tikzpicture}

    bigskip

    begin{tikzpicture}
    node[photo,draw=red!80,thick] at (0,0)
    {includegraphics[width=110mm]{chipping-sparrow-wiki-commons-1900x855.jpg}};
    end{tikzpicture}

    end{document}


    The second tikzpicture gives me an error:
    ! Package tikz Error: Extra options not allowed for clipping path command..



    And the result looks like this:(Image by DickDaniels, CC-BY-SA, from https://www.innonmillcreek.com/blog/2017/01/north-carolina-mountain-birds-chipping-sparrow.html)



    I guess I could use path and node combination, but I don't know image size.



    How can I get clipped image with border in this case?










    share|improve this question

























      3












      3








      3







      I want to round corners of image and I want to have border around:



      documentclass{article}
      usepackage{tikz}
      usetikzlibrary{shadows.blur,fadings}

      tikzset{
      photo/.style={ inner sep=1pt,clip,rounded corners=0.5cm }
      }

      begin{document}

      begin{tikzpicture}
      node[photo] at (0,0)
      {includegraphics[width=110mm]{chipping-sparrow-wiki-commons-1900x855.jpg}};
      end{tikzpicture}

      bigskip

      begin{tikzpicture}
      node[photo,draw=red!80,thick] at (0,0)
      {includegraphics[width=110mm]{chipping-sparrow-wiki-commons-1900x855.jpg}};
      end{tikzpicture}

      end{document}


      The second tikzpicture gives me an error:
      ! Package tikz Error: Extra options not allowed for clipping path command..



      And the result looks like this:(Image by DickDaniels, CC-BY-SA, from https://www.innonmillcreek.com/blog/2017/01/north-carolina-mountain-birds-chipping-sparrow.html)



      I guess I could use path and node combination, but I don't know image size.



      How can I get clipped image with border in this case?










      share|improve this question













      I want to round corners of image and I want to have border around:



      documentclass{article}
      usepackage{tikz}
      usetikzlibrary{shadows.blur,fadings}

      tikzset{
      photo/.style={ inner sep=1pt,clip,rounded corners=0.5cm }
      }

      begin{document}

      begin{tikzpicture}
      node[photo] at (0,0)
      {includegraphics[width=110mm]{chipping-sparrow-wiki-commons-1900x855.jpg}};
      end{tikzpicture}

      bigskip

      begin{tikzpicture}
      node[photo,draw=red!80,thick] at (0,0)
      {includegraphics[width=110mm]{chipping-sparrow-wiki-commons-1900x855.jpg}};
      end{tikzpicture}

      end{document}


      The second tikzpicture gives me an error:
      ! Package tikz Error: Extra options not allowed for clipping path command..



      And the result looks like this:(Image by DickDaniels, CC-BY-SA, from https://www.innonmillcreek.com/blog/2017/01/north-carolina-mountain-birds-chipping-sparrow.html)



      I guess I could use path and node combination, but I don't know image size.



      How can I get clipped image with border in this case?







      tikz-pgf graphics clip






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked Dec 8 at 13:11









      brownian

      41428




      41428






















          2 Answers
          2






          active

          oldest

          votes


















          3














          The clipped image is a node and can be named (name=clipped). Later a rectangle can be drawn like this:



          draw (clipped.south west) rectangle (clipped.north east);


          enter image description here



          documentclass{article}
          usepackage{tikz}
          usetikzlibrary{shadows.blur,fadings}

          tikzset{
          photo/.style={inner sep=1pt,clip,rounded corners=0.5cm }
          }

          begin{document}
          begin{tikzpicture}
          node[photo] at (0,0)
          {includegraphics[width=110mm]{chipping-sparrow-wiki-commons-1900x855.jpg}};
          end{tikzpicture}

          bigskip

          begin{tikzpicture}
          node[photo,name=clipped] at (0,0)
          {includegraphics[width=110mm]{chipping-sparrow-wiki-commons-1900x855.jpg}};
          draw[red,thick, rounded corners=0.5cm] (clipped.south west) rectangle (clipped.north east);
          end{tikzpicture}
          end{document}





          share|improve this answer























          • GREAT, thank you)
            – brownian
            Dec 8 at 19:01



















          4














          You can get the image height with the command:



          pgfdeclareimage[width=110mm]{image1}{/path/your/image}
          settoheight{imageheight}{pgfuseimage{image1}}


          After, I added a rectangle node with your desired options:



          documentclass{article}
          usepackage{tikz}
          usetikzlibrary{shadows.blur,fadings}

          tikzset{
          photo/.style={ inner sep=1pt,clip,rounded corners=0.5cm }
          }
          newlengthimageheight

          begin{document}
          pgfdeclareimage[width=110mm]{image1}{bird.jpg}
          settoheight{imageheight}{pgfuseimage{image1}}


          begin{tikzpicture}

          node[photo] at (0,0)
          {includegraphics[width=110mm]{bird.jpg}};
          end{tikzpicture}

          bigskip

          begin{tikzpicture}
          node[photo] at (0,0)
          {includegraphics[width=110mm]{bird.jpg}};
          node (rect) at (0,0) [draw,thick,minimum width=110mm,minimum height=imageheight,draw=red!80,thick,rounded corners=0.5cm] {};
          end{tikzpicture}

          end{document}


          enter image description here






          share|improve this answer





















            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%2f463810%2ftikz-clip-image-with-rounded-corners-and-border%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









            3














            The clipped image is a node and can be named (name=clipped). Later a rectangle can be drawn like this:



            draw (clipped.south west) rectangle (clipped.north east);


            enter image description here



            documentclass{article}
            usepackage{tikz}
            usetikzlibrary{shadows.blur,fadings}

            tikzset{
            photo/.style={inner sep=1pt,clip,rounded corners=0.5cm }
            }

            begin{document}
            begin{tikzpicture}
            node[photo] at (0,0)
            {includegraphics[width=110mm]{chipping-sparrow-wiki-commons-1900x855.jpg}};
            end{tikzpicture}

            bigskip

            begin{tikzpicture}
            node[photo,name=clipped] at (0,0)
            {includegraphics[width=110mm]{chipping-sparrow-wiki-commons-1900x855.jpg}};
            draw[red,thick, rounded corners=0.5cm] (clipped.south west) rectangle (clipped.north east);
            end{tikzpicture}
            end{document}





            share|improve this answer























            • GREAT, thank you)
              – brownian
              Dec 8 at 19:01
















            3














            The clipped image is a node and can be named (name=clipped). Later a rectangle can be drawn like this:



            draw (clipped.south west) rectangle (clipped.north east);


            enter image description here



            documentclass{article}
            usepackage{tikz}
            usetikzlibrary{shadows.blur,fadings}

            tikzset{
            photo/.style={inner sep=1pt,clip,rounded corners=0.5cm }
            }

            begin{document}
            begin{tikzpicture}
            node[photo] at (0,0)
            {includegraphics[width=110mm]{chipping-sparrow-wiki-commons-1900x855.jpg}};
            end{tikzpicture}

            bigskip

            begin{tikzpicture}
            node[photo,name=clipped] at (0,0)
            {includegraphics[width=110mm]{chipping-sparrow-wiki-commons-1900x855.jpg}};
            draw[red,thick, rounded corners=0.5cm] (clipped.south west) rectangle (clipped.north east);
            end{tikzpicture}
            end{document}





            share|improve this answer























            • GREAT, thank you)
              – brownian
              Dec 8 at 19:01














            3












            3








            3






            The clipped image is a node and can be named (name=clipped). Later a rectangle can be drawn like this:



            draw (clipped.south west) rectangle (clipped.north east);


            enter image description here



            documentclass{article}
            usepackage{tikz}
            usetikzlibrary{shadows.blur,fadings}

            tikzset{
            photo/.style={inner sep=1pt,clip,rounded corners=0.5cm }
            }

            begin{document}
            begin{tikzpicture}
            node[photo] at (0,0)
            {includegraphics[width=110mm]{chipping-sparrow-wiki-commons-1900x855.jpg}};
            end{tikzpicture}

            bigskip

            begin{tikzpicture}
            node[photo,name=clipped] at (0,0)
            {includegraphics[width=110mm]{chipping-sparrow-wiki-commons-1900x855.jpg}};
            draw[red,thick, rounded corners=0.5cm] (clipped.south west) rectangle (clipped.north east);
            end{tikzpicture}
            end{document}





            share|improve this answer














            The clipped image is a node and can be named (name=clipped). Later a rectangle can be drawn like this:



            draw (clipped.south west) rectangle (clipped.north east);


            enter image description here



            documentclass{article}
            usepackage{tikz}
            usetikzlibrary{shadows.blur,fadings}

            tikzset{
            photo/.style={inner sep=1pt,clip,rounded corners=0.5cm }
            }

            begin{document}
            begin{tikzpicture}
            node[photo] at (0,0)
            {includegraphics[width=110mm]{chipping-sparrow-wiki-commons-1900x855.jpg}};
            end{tikzpicture}

            bigskip

            begin{tikzpicture}
            node[photo,name=clipped] at (0,0)
            {includegraphics[width=110mm]{chipping-sparrow-wiki-commons-1900x855.jpg}};
            draw[red,thick, rounded corners=0.5cm] (clipped.south west) rectangle (clipped.north east);
            end{tikzpicture}
            end{document}






            share|improve this answer














            share|improve this answer



            share|improve this answer








            edited Dec 8 at 17:13

























            answered Dec 8 at 17:00









            nidhin

            3,344927




            3,344927












            • GREAT, thank you)
              – brownian
              Dec 8 at 19:01


















            • GREAT, thank you)
              – brownian
              Dec 8 at 19:01
















            GREAT, thank you)
            – brownian
            Dec 8 at 19:01




            GREAT, thank you)
            – brownian
            Dec 8 at 19:01











            4














            You can get the image height with the command:



            pgfdeclareimage[width=110mm]{image1}{/path/your/image}
            settoheight{imageheight}{pgfuseimage{image1}}


            After, I added a rectangle node with your desired options:



            documentclass{article}
            usepackage{tikz}
            usetikzlibrary{shadows.blur,fadings}

            tikzset{
            photo/.style={ inner sep=1pt,clip,rounded corners=0.5cm }
            }
            newlengthimageheight

            begin{document}
            pgfdeclareimage[width=110mm]{image1}{bird.jpg}
            settoheight{imageheight}{pgfuseimage{image1}}


            begin{tikzpicture}

            node[photo] at (0,0)
            {includegraphics[width=110mm]{bird.jpg}};
            end{tikzpicture}

            bigskip

            begin{tikzpicture}
            node[photo] at (0,0)
            {includegraphics[width=110mm]{bird.jpg}};
            node (rect) at (0,0) [draw,thick,minimum width=110mm,minimum height=imageheight,draw=red!80,thick,rounded corners=0.5cm] {};
            end{tikzpicture}

            end{document}


            enter image description here






            share|improve this answer


























              4














              You can get the image height with the command:



              pgfdeclareimage[width=110mm]{image1}{/path/your/image}
              settoheight{imageheight}{pgfuseimage{image1}}


              After, I added a rectangle node with your desired options:



              documentclass{article}
              usepackage{tikz}
              usetikzlibrary{shadows.blur,fadings}

              tikzset{
              photo/.style={ inner sep=1pt,clip,rounded corners=0.5cm }
              }
              newlengthimageheight

              begin{document}
              pgfdeclareimage[width=110mm]{image1}{bird.jpg}
              settoheight{imageheight}{pgfuseimage{image1}}


              begin{tikzpicture}

              node[photo] at (0,0)
              {includegraphics[width=110mm]{bird.jpg}};
              end{tikzpicture}

              bigskip

              begin{tikzpicture}
              node[photo] at (0,0)
              {includegraphics[width=110mm]{bird.jpg}};
              node (rect) at (0,0) [draw,thick,minimum width=110mm,minimum height=imageheight,draw=red!80,thick,rounded corners=0.5cm] {};
              end{tikzpicture}

              end{document}


              enter image description here






              share|improve this answer
























                4












                4








                4






                You can get the image height with the command:



                pgfdeclareimage[width=110mm]{image1}{/path/your/image}
                settoheight{imageheight}{pgfuseimage{image1}}


                After, I added a rectangle node with your desired options:



                documentclass{article}
                usepackage{tikz}
                usetikzlibrary{shadows.blur,fadings}

                tikzset{
                photo/.style={ inner sep=1pt,clip,rounded corners=0.5cm }
                }
                newlengthimageheight

                begin{document}
                pgfdeclareimage[width=110mm]{image1}{bird.jpg}
                settoheight{imageheight}{pgfuseimage{image1}}


                begin{tikzpicture}

                node[photo] at (0,0)
                {includegraphics[width=110mm]{bird.jpg}};
                end{tikzpicture}

                bigskip

                begin{tikzpicture}
                node[photo] at (0,0)
                {includegraphics[width=110mm]{bird.jpg}};
                node (rect) at (0,0) [draw,thick,minimum width=110mm,minimum height=imageheight,draw=red!80,thick,rounded corners=0.5cm] {};
                end{tikzpicture}

                end{document}


                enter image description here






                share|improve this answer












                You can get the image height with the command:



                pgfdeclareimage[width=110mm]{image1}{/path/your/image}
                settoheight{imageheight}{pgfuseimage{image1}}


                After, I added a rectangle node with your desired options:



                documentclass{article}
                usepackage{tikz}
                usetikzlibrary{shadows.blur,fadings}

                tikzset{
                photo/.style={ inner sep=1pt,clip,rounded corners=0.5cm }
                }
                newlengthimageheight

                begin{document}
                pgfdeclareimage[width=110mm]{image1}{bird.jpg}
                settoheight{imageheight}{pgfuseimage{image1}}


                begin{tikzpicture}

                node[photo] at (0,0)
                {includegraphics[width=110mm]{bird.jpg}};
                end{tikzpicture}

                bigskip

                begin{tikzpicture}
                node[photo] at (0,0)
                {includegraphics[width=110mm]{bird.jpg}};
                node (rect) at (0,0) [draw,thick,minimum width=110mm,minimum height=imageheight,draw=red!80,thick,rounded corners=0.5cm] {};
                end{tikzpicture}

                end{document}


                enter image description here







                share|improve this answer












                share|improve this answer



                share|improve this answer










                answered Dec 8 at 14:38









                ferahfeza

                5,23411830




                5,23411830






























                    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%2f463810%2ftikz-clip-image-with-rounded-corners-and-border%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

                    flock() on closed filehandle LOCK_FILE at /usr/bin/apt-mirror

                    Mangá

                    Eduardo VII do Reino Unido