#svg #puzzle #template #graphics #game


Provides SVG paths for creating a jigsaw puzzle of an image

1 unstable release

0.0.9 Dec 18, 2023

#420 in Images


551 lines

Puzzle Paths

This library creates SVG paths suitable for cutting out jigsaw puzzle pieces of an image.



The library is heavily inspired by @Draradech's Jigsaw Puzzle Generator (see it here in action).


The Jigsaw Puzzle library creates SVG paths which can be used to cut out puzzle pieces from a given rectangular image. It provides three public functions:

  • build_jigsaw_template returns the paths from a given number of pieces in a column and a row. This is the function you normally want to use
  • generate_columns_rows_numbers returns an ideal distribution of pieces on the x- and y-axes for a given total number of pieces
  • round is a util function which approximately rounds a f32 value to two decimal places

No runtime deps