# 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
<img src="https://github.com/nitfe/tarraz/raw/v1.2.0/images/palestine.png" alt="Palestinian Flag" style="display: inline-block; margin: 0 auto; max-width: 600px"/>
<img src="https://github.com/nitfe/tarraz/raw/v1.2.0/images/results/colored_symbols.jpg" alt="Colored with Symbols" style="display: inline-block; margin: 0 auto; max-width: 300px"/>
<img src="https://github.com/nitfe/tarraz/raw/v1.2.0/images/results/black_white_symbols.jpg" alt="Black White with Symbols" style="display: inline-block; margin: 0 auto; max-width: 300px"/>
<img src="https://github.com/nitfe/tarraz/raw/v1.2.0/images/results/colored.jpg" alt="Colored" style="display: inline-block; margin: 0 auto; max-width: 300px"/>
<img src="https://github.com/nitfe/tarraz/raw/v1.2.0/images/results/key.jpg" alt="Keys" style="display: inline-block; margin: 0 auto; max-width: 300px; height: 256px"/>
## Usage
### Installation
```
pip install tarraz
```
### CLI Example
```shell
tarraz images/palestine.png --colors 4 --stitches-count 200
```
### Python Example
```python
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
```shell
$ 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
```shell
pip3 install -U pip setuptools
pip3 install poetry
# Optional Auto-completion
poetry completions zsh > ~/.zfunc/_poetry
```
### Install dependencies
```shell
poetry shell
poetry install
pre-commit install
```
> [!NOTE]
> If you don't want to keep the current package installed run
> `pip uninstall tarraz`. However, you might want to add the project
> to your `PYTHONPATH` using `export PYTHONPATH="${PYTHONPATH}:/path/to/tarraz"`
### Usage
Continue usage as listed above
Raw data
{
"_id": null,
"home_page": "https://www.nitfe.com/",
"name": "tarraz",
"maintainer": "",
"docs_url": null,
"requires_python": ">=3.8",
"maintainer_email": "",
"keywords": "cross-stitch,pattern,stitch,DMC",
"author": "Ahmed Jazzar",
"author_email": "ahmed@nitfe.com",
"download_url": "https://files.pythonhosted.org/packages/99/f7/d4ec417a4d86f27677b377021ef3a46abc2a2b459a49b7e5969676e2cdba/tarraz-1.2.1.tar.gz",
"platform": null,
"description": "# Tarraz | \u0637\u0631\u0651\u0627\u0632\nA cross-stitch image generator.\nGenerates a cross stitch pattern from an image of your choice. The generated pattern is DMC colored.\n\nTakes an image file and generates a cross stitch pattern using a user specified color..\n\n## Supported image extensions\n1. JPEG (.jpg, .jpeg)\n2. PNG (.png)\n3. WebP (.webp)\n\n## Current color providers\n1. DMC\n\n## Results\n\n<img src=\"https://github.com/nitfe/tarraz/raw/v1.2.0/images/palestine.png\" alt=\"Palestinian Flag\" style=\"display: inline-block; margin: 0 auto; max-width: 600px\"/>\n\n<img src=\"https://github.com/nitfe/tarraz/raw/v1.2.0/images/results/colored_symbols.jpg\" alt=\"Colored with Symbols\" style=\"display: inline-block; margin: 0 auto; max-width: 300px\"/>\n<img src=\"https://github.com/nitfe/tarraz/raw/v1.2.0/images/results/black_white_symbols.jpg\" alt=\"Black White with Symbols\" style=\"display: inline-block; margin: 0 auto; max-width: 300px\"/>\n<img src=\"https://github.com/nitfe/tarraz/raw/v1.2.0/images/results/colored.jpg\" alt=\"Colored\" style=\"display: inline-block; margin: 0 auto; max-width: 300px\"/>\n<img src=\"https://github.com/nitfe/tarraz/raw/v1.2.0/images/results/key.jpg\" alt=\"Keys\" style=\"display: inline-block; margin: 0 auto; max-width: 300px; height: 256px\"/>\n\n\n## Usage\n### Installation\n```\npip install tarraz\n```\n\n### CLI Example\n```shell\ntarraz images/palestine.png --colors 4 --stitches-count 200\n```\n\n### Python Example\n\n```python\nfrom tarraz import constants\nfrom tarraz.processor import Tarraz\nfrom tarraz.providers import DMCProvider\nfrom tarraz.stitcher import SVGStitcher\nfrom tarraz.models import RGB\n\n\n# Choose a color provider\nimage_path = \"images/palestine.png\"\nprovider = DMCProvider()\n\ntarraz = Tarraz(\n image_path,\n provider=provider, # Optional if not using a custom provider\n x_count=100, # Default 50\n colors_num=6, # default 3\n result_width=200, # Default 1000\n cleanup=True, # Default True\n)\n\n# Process the image\npattern, colors = tarraz.process()\n\n# Stitch the result\nSVGStitcher.stitch(\n pattern,\n colors,\n tarraz.size,\n transparent=[RGB(255,255,255)],\n configs=constants.SVG_VARIANTS,\n cell_size=10,\n save_to=\"/tmp/test/\",\n)\n\n```\n\n### Options\n```shell\n$ tarraz --help\nusage: tarraz [-h] [--version] [-c COLORS] [-n STITCHES_COUNT] [-w WIDTH] [-m DMC] [-t TRANSPARENT [TRANSPARENT ...]] [-o DIST] [-z CELL_SIZE] [--no-cleanup] [--svg] image\n\nGenerate a DMC-colored cross-stitch pattern from a given image.\n\npositional arguments:\n image Input image\n\noptional arguments:\n -h, --help show this help message and exit\n -v, --version show program's version number and exit\n -c COLORS, --colors COLORS\n Number of colors to use in the pattern.\n -n STITCHES_COUNT, --stitches-count STITCHES_COUNT\n Number of stitches to use in the x axis.\n -w WIDTH, --width WIDTH\n Result pattern width.\n -m DMC, --dmc DMC DMC json color path.\n -t TRANSPARENT [TRANSPARENT ...], --transparent TRANSPARENT [TRANSPARENT ...]\n A Color to ignore from the end result.\n -o DIST, --dist DIST DMC json color path.\n -z CELL_SIZE, --cell-size CELL_SIZE\n The size of the generated Aida fabric cell.\n --no-cleanup Don't run cleanup job on generated image.\n --svg Export result to svg files.\n```\n\n\n## Development\n## Pre-requisites\n```shell\npip3 install -U pip setuptools\npip3 install poetry\n\n\n# Optional Auto-completion\npoetry completions zsh > ~/.zfunc/_poetry\n```\n### Install dependencies\n```shell\npoetry shell\npoetry install\npre-commit install\n```\n\n> [!NOTE]\n> If you don't want to keep the current package installed run\n> `pip uninstall tarraz`. However, you might want to add the project\n> to your `PYTHONPATH` using `export PYTHONPATH=\"${PYTHONPATH}:/path/to/tarraz\"`\n\n### Usage\nContinue usage as listed above\n\n",
"bugtrack_url": null,
"license": "GNU Affero General Public License v3",
"summary": "A cross-stitch image generator. Generates a cross stitch pattern given by a user and generates a DMC colored pattern.",
"version": "1.2.1",
"project_urls": {
"Changelog": "https://github.com/nitfe/tarraz/releases",
"Documentation": "https://github.com/nitfe/tarraz/blob/main/README.md",
"Homepage": "https://www.nitfe.com/",
"Issues": "https://github.com/nitfe/tarraz/issues",
"Repository": "https://github.com/nitfe/tarraz.git"
},
"split_keywords": [
"cross-stitch",
"pattern",
"stitch",
"dmc"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "9901f4e23b175335cd334778075613372ba5253156bd6d597d243c5cbd60697b",
"md5": "9427eb4b7308dcb2883e97e7350949ce",
"sha256": "eac6974fd318ee5a6c1ef9ef78f8db7e4bf3e15059cb35a18a3c89b40bb16204"
},
"downloads": -1,
"filename": "tarraz-1.2.1-py3-none-any.whl",
"has_sig": false,
"md5_digest": "9427eb4b7308dcb2883e97e7350949ce",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.8",
"size": 35012,
"upload_time": "2024-02-15T06:40:12",
"upload_time_iso_8601": "2024-02-15T06:40:12.529799Z",
"url": "https://files.pythonhosted.org/packages/99/01/f4e23b175335cd334778075613372ba5253156bd6d597d243c5cbd60697b/tarraz-1.2.1-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "99f7d4ec417a4d86f27677b377021ef3a46abc2a2b459a49b7e5969676e2cdba",
"md5": "b8c5478fd17a6639bca2e7fcd7233600",
"sha256": "6f50e11a660c546b0875170935128af1e46fa11a8779385e4f31ecc1daf577e7"
},
"downloads": -1,
"filename": "tarraz-1.2.1.tar.gz",
"has_sig": false,
"md5_digest": "b8c5478fd17a6639bca2e7fcd7233600",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.8",
"size": 32661,
"upload_time": "2024-02-15T06:40:14",
"upload_time_iso_8601": "2024-02-15T06:40:14.289332Z",
"url": "https://files.pythonhosted.org/packages/99/f7/d4ec417a4d86f27677b377021ef3a46abc2a2b459a49b7e5969676e2cdba/tarraz-1.2.1.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-02-15 06:40:14",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "nitfe",
"github_project": "tarraz",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"lcname": "tarraz"
}