Skip to main content

Create jigsaw puzzle pieces from an image

Project description

The Jigsaw Piece Maker

A jigsaw puzzle pieces generator that levels the playing field.

It creates jigsaw puzzle pieces in multiple formats: svg, jpg, and png. The number and size of pieces are set by passing the script different options. It takes a while to run if doing a lot of pieces. Extra JSON files are created with details on size of pieces and adjacent pieces information which is commonly used when verifying that two pieces can join together.

Samples from different generated puzzles:

generated piece generated piece sample generated piece cut example

Try out by running the piecemaker.sh script that will prompt for necessary options and run piecemaker inside a docker container. It will use the files in the examples directory by default.

# Build and run using docker
./piecemaker.sh

Installing

Requires:

Python Packages:

Other Software needed:

If on ubuntu or other debian based distro

apt-get --yes install libspatialindex8
apt-get --yes install optipng
apt-get --yes install python3-pil
apt-get --yes install potrace libffi-dev libxml2-dev python3-lxml python3-xcffib
apt-get --yes install librsvg2-bin
apt-get --yes install python3-pip

Install with pip in editable mode for developing and use virtualenv to isolate python dependencies

python3 -m venv .venv
source .venv/bin/activate
pip install --upgrade --upgrade-strategy eager -e .

Usage

See the script.py for more. Not everything has been implemented. Use this example command to create 100 randomly generated jigsaw puzzle pieces from test.jpg image. This assumes that the 'test1' directory is empty since that is where it will be placing all the generated files. The test.jpg is the source image that will be used when creating the pieces. It is not modified.

piecemaker --dir test1  --number-of-pieces 100 test.jpg

Example of using an already existing svg file with jigsaw puzzle cut lines. The 'test2' directory should be empty as well. Note that the svg file (test2-custom-cut-lines.svg) and the image (test.jpg) both need to be the same width and height. Try this out by using a previously generated 'lines-resized.svg' from a different puzzle and a different image to create a new puzzle with identical piece cuts.

piecemaker --dir test2 --svg test2-custom-cut-lines.svg test.jpg

Other Suggested Tools

Create SVG files for jigsaws with tools from proceduraljigsaw.

SVG editing tools

Contributing

Please contact Jake Hickenlooper or create an issue.

Any submitted changes to this project require the commits to be signed off with the git command option '--signoff'. This ensures that the committer has the rights to submit the changes under the project's license and agrees to the Developer Certificate of Origin.

License

GNU Lesser General Public License v3.0

Maintenance

Where possible, an upkeep comment has been added to various parts of the source code. These are known areas that will require updates over time to reduce software rot. The upkeep comment follows this pattern to make it easier for commands like grep to find these comments.

Example UPKEEP comment has at least a 'due:' or 'label:' or 'interval:' value surrounded by double quotes (").

Example-> # UPKEEP due: "2022-12-14" label: "an example upkeep label" interval: "+4 months"

Show only past due UPKEEP comments.

make upkeep

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

piecemaker-0.8.0.tar.gz (33.3 kB view details)

Uploaded Source

Built Distribution

piecemaker-0.8.0-py3-none-any.whl (39.6 kB view details)

Uploaded Python 3

File details

Details for the file piecemaker-0.8.0.tar.gz.

File metadata

  • Download URL: piecemaker-0.8.0.tar.gz
  • Upload date:
  • Size: 33.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.0.1 CPython/3.10.12

File hashes

Hashes for piecemaker-0.8.0.tar.gz
Algorithm Hash digest
SHA256 a35735574a739dd447438c9f85b80b044e6361cef0f4c5ad06ac1936dd37a539
MD5 7a147b26922b9b4ebdb4c43e2fd64040
BLAKE2b-256 6af2d1d0bb7bba8e909031ef8d4ae900089d4154fb423e8c969dbb09a0b09fd9

See more details on using hashes here.

File details

Details for the file piecemaker-0.8.0-py3-none-any.whl.

File metadata

  • Download URL: piecemaker-0.8.0-py3-none-any.whl
  • Upload date:
  • Size: 39.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.0.1 CPython/3.10.12

File hashes

Hashes for piecemaker-0.8.0-py3-none-any.whl
Algorithm Hash digest
SHA256 691bb0a81638d4925527759f09a78fdf4b8eddfa903c25eddc85e2cc04cd9d91
MD5 2c38ae51416e20aa3afad9bab43bf9d2
BLAKE2b-256 0cb05397762148843a6bec82e5ece92186c539eecdde3de0863a2abdf81847d1

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page