Let's suppose that we have any image in .pdf, in .jpg in .png.

Exist a package to break into the fragments of an image like a classic puzzle?

I would like each piece of the puzzle to also have the possibility, if possible, of noting or writing down a comment with an arrow.

  • 1
    yes for pieces see the other Sebastian question tex.stackexchange.com/a/446296 but may need some extra modification such as other answers for the zoomed piece effect see tex.stackexchange.com/questions/267714/inset-within-image etc – user170109 May 21 at 20:34
  • @KJO Dear, thank you for the link I saw. The image is behind and above it is created a puzzle that can not certainly separate pieces. In other words, I don't want a puzzle drawn over the image. But the image is created by tiles. – Sebastiano May 21 at 20:37
  • 1
    Off hand I cant see any reason unless someone does not like Einstein or Jigsaws – user170109 May 23 at 21:15
  • 1
    @KJO I have to change the images or take them off :-):-) – Sebastiano May 23 at 21:22
  • 2
    Possible duplicate of Moving tiles of the pattern in TikZ – Raaja May 24 at 11:58

The picture can be set with a pgf key.

\documentclass[x11names, svgnames, dvipsnames,tikz,border=3.14mm]{standalone}
image jigsaw/.style args={img at #1 and #2/#3/#4/#5}{
\draw[path picture={%
\node at #1
{\edef\temp{\noexpand\includegraphics[\pgfkeysvalueof{/tikz/jigsaw/img options}]{\pgfkeysvalueof{/tikz/jigsaw/img}}}
\temp};}] (-2,-0.35) to[out=90,in={90+#2*45}] ({-2+0.5*#2},-0.45) 
arc({-135-(#2-1)*45}:{(#2-1)*180+135+(#2-1)*45}:0.6 and
{0.45*sqrt(2)}) to[out=-90-#2*45,in=-90] (-2,0.35) |- (-0.35,2)
to[out=0,in={0+#3*45}] (-0.45,2-0.5*#3) arc(180-#3*45:{(#3+1)*180+#3*45}:{0.45*sqrt(2)} and 0.6)
to[out=-180-#3*45,in=180] (0.35,2) -| (2,0.35) 
to[out=-90,in=270+#4*45] (2-#4*0.5,0.45) 
arc(90-#4*45:{(#4+1)*180-90+#4*45}:0.6 and {0.45*sqrt(2)})
to[out=90-#4*45,in=90] (2,-0.35) |- (0.35,-2)
to[out=180,in=-180+#5*45] (0.45,-2+#5*0.5) arc(-#5*45:{(#5-1)*180+180+#5*45}:{0.45*sqrt(2)} and 0.6) 
to[out=-#5*45,in=0] (-0.35,-2) -| cycle;
/tikz/jigsaw/.cd,img/.initial={example-image-duck},img options/.initial={}
% order : left/top/right/bottom and -1 is out, 1 is in, 0 none
\foreach \X in {0,0.1,...,1,0.9,0.8,...,0.1}
\path[use as bounding box] (-3,-3) rectangle (3,3);
\draw (-1-\X,-1-\X) pic[scale=0.25]{image jigsaw=img at {(4,4)} and 0/-1/1/0}
(0,-1-\X) pic[scale=0.25]{image jigsaw=img at {(0,4)} and -1/-1/1/0}
(1+\X,-1-\X) pic[scale=0.25]{image jigsaw=img at {(-4,4)} and -1/1/0/0}
(-1-\X,0) pic[scale=0.25]{image jigsaw=img at {(4,0)} and 0/1/-1/1}
(0,0) pic[scale=0.25]{image jigsaw=img at {(0,0)} and 1/-1/1/1}
(1+\X,0) pic[scale=0.25]{image jigsaw=img at {(-4,0)} and -1/1/0/-1}
(-1-\X,1+\X) pic[scale=0.25]{image jigsaw=img at {(4,-4)} and 0/0/1/-1}
(0,1+\X) pic[scale=0.25]{image jigsaw=img at {(0,-4)} and -1/0/1/1}
(1+\X,1+\X) pic[scale=0.25]{image jigsaw=img at {(-4,-4)} and -1/0/0/-1};

enter image description here

  • 4
    Normally I don't upvote do-it-yourself-answers but this one is really nice :) +1 – Marijn May 21 at 21:23
  • @Marijn Nice is understatement I think marmot has taken time off chores today and working at double speed. I am "flabbergasted" at how quick he got this working even IF there was any recycling PS Tongue in cheek I see no zoom :-! – user170109 May 21 at 21:29
  • 1
    @KJO Zoom is hidden in the pgf key /tikz/jigsaw/img options, which you can set e.g. to scale=2. It is not used here. – user121799 May 21 at 21:44

There is a dedicated package for jigsaws, with this its easy to do something like this:



\side{#2} -- (0.5,0.5) [rotate around={90:(0.5,0.5)}] \side{#3} -- (0.5,0.5) [rotate around={180:(0.5,0.5)}] \side{#5} -- (0.5,0.5) [rotate around={270:(0.5,0.5)}] \side{#4} -- (0.5,0.5) -- cycle;   
\node[inner sep=0pt] at (1,-0.7) {\includegraphics[width=3cm]{Lauda_at_1982_Dutch_Grand_Prix}};  % image from https://en.wikipedia.org/wiki/Niki_Lauda#/media/File:Lauda_at_1982_Dutch_Grand_Prix.jpg







enter image description here

  • I like it very much with such sincerity. Is it possible to put comments next to the cards? Thank you very much. – Sebastiano May 22 at 8:31

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.