Skip to main content

Tarraz | طرّاز

A cross-stitch image generator. Generates a cross stitch pattern from an image of your choice. The generated pattern is DMC colored.

Takes an image file and generates a cross stitch pattern using a user specified color..

Supported image extensions

  1. JPEG (.jpg, .jpeg)
  2. PNG (.png)
  3. WebP (.webp)

Current color providers

  1. DMC

Results

Palestinian Flag Colored with Symbols Black White with Symbols Colored Keys

Usage

Installation

pip install tarraz

CLI Example

tarraz images/palestine.png --colors 4 --stitches-count 200

Python Example

from tarraz import constants
from tarraz.processor import Tarraz
from tarraz.providers import DMCProvider
from tarraz.stitcher import SVGStitcher
from tarraz.models import RGB


# Choose a color provider
image_path = "images/palestine.png"
provider = DMCProvider()

tarraz = Tarraz(
    image_path,
    provider=provider,  # Optional if not using a custom provider
    x_count=100,        # Default 50
    colors_num=6,       # default 3
    result_width=200,   # Default 1000
    cleanup=True,       # Default True
)

# Process the image
pattern, colors = tarraz.process()

# Stitch the result
SVGStitcher.stitch(
    pattern,
    colors,
    tarraz.size,
    transparent=[RGB(255,255,255)],
    configs=constants.SVG_VARIANTS,
    cell_size=10,
    save_to="/tmp/test/",
)

Options

$ tarraz --help
usage: tarraz [-h] [--version] [-c COLORS] [-n STITCHES_COUNT] [-w WIDTH] [-m DMC] [-t TRANSPARENT [TRANSPARENT ...]] [-o DIST] [-z CELL_SIZE] [--no-cleanup] [--svg] image

Generate a DMC-colored cross-stitch pattern from a given image.

positional arguments:
  image                 Input image

optional arguments:
  -h, --help            show this help message and exit
  -v, --version         show program's version number and exit
  -c COLORS, --colors COLORS
                        Number of colors to use in the pattern.
  -n STITCHES_COUNT, --stitches-count STITCHES_COUNT
                        Number of stitches to use in the x axis.
  -w WIDTH, --width WIDTH
                        Result pattern width.
  -m DMC, --dmc DMC     DMC json color path.
  -t TRANSPARENT [TRANSPARENT ...], --transparent TRANSPARENT [TRANSPARENT ...]
                        A Color to ignore from the end result.
  -o DIST, --dist DIST  DMC json color path.
  -z CELL_SIZE, --cell-size CELL_SIZE
                        The size of the generated Aida fabric cell.
  --no-cleanup          Don't run cleanup job on generated image.
  --svg                 Export result to svg files.

Development

Pre-requisites

pip3 install -U pip setuptools
pip3 install poetry


# Optional Auto-completion
poetry completions zsh > ~/.zfunc/_poetry

Install dependencies

poetry shell
poetry install
pre-commit install

Usage

Continue usage as listed above

Metadata

Release files for tarraz 1.2.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for tarraz 1.2.1
File Size Uploaded Provenance
tarraz-1.2.1.tar.gz 32.7 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for tarraz 1.2.1
File Interpreter ABI Platform
tarraz-1.2.1-py3-none-any.whl Python 3 none any Details

Total release size: 67.7 kB

Release files / tarraz-1.2.1.tar.gz

Download URL tarraz-1.2.1.tar.gz
Size 32.7 kB
Tags Source
SHA-256 checksum
How to use checksums
6f50e11a660c546b0875170935128af1e46fa11a8779385e4f31ecc1daf577e7
BLAKE2b-256 checksum
How to use checksums
99f7d4ec417a4d86f27677b377021ef3a46abc2a2b459a49b7e5969676e2cdba
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.11.8

Release files / tarraz-1.2.1-py3-none-any.whl

Download URL tarraz-1.2.1-py3-none-any.whl
Size 35.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
eac6974fd318ee5a6c1ef9ef78f8db7e4bf3e15059cb35a18a3c89b40bb16204
BLAKE2b-256 checksum
How to use checksums
9901f4e23b175335cd334778075613372ba5253156bd6d597d243c5cbd60697b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.11.8

Security for tarraz 1.2.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page