Skip to main content

Create jigsaw puzzle pieces from an image

Project description

A jigsaw puzzle pieces generator that levels the playing field.

Currently in use by Puzzle Massive to create puzzles with 5000+ pieces.

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.

Installing

Requires:

Python Packages:

Other Software needed:

If on ubuntu or other debian based distro:

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

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

python3 -m venv .
source ./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 ‘test’ 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 test  --number-of-pieces 100 test.jpg

Docker Usage

A Dockerfile also can be used to build an image and run it.:

docker build -t piecemaker:latest .

mkdir -p out/tmp
cp test.jpg out/
rm -rf out/tmp/*

docker run -it --rm \
    --mount type=bind,src=$(pwd)/out,dst=/out \
    piecemaker:latest \
    piecemaker --dir /out/tmp --number-of-pieces 100 /out/test.jpg

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.4.5.tar.gz (45.8 kB view details)

Uploaded Source

File details

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

File metadata

  • Download URL: piecemaker-0.4.5.tar.gz
  • Upload date:
  • Size: 45.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.8.10

File hashes

Hashes for piecemaker-0.4.5.tar.gz
Algorithm Hash digest
SHA256 f4ee3079572e40536c6393a7ef77422b8c4e0f428cb075a1f2b23d1c6336e6a2
MD5 c342f895e263d178b775a1997072edd9
BLAKE2b-256 35fa2a4a4401f2b9d5da78f9c8b451e75768690ab8da8db88e18d241e7f5c15f

See more details on using hashes here.

Supported by

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