Skip to content

Commit

Permalink
upd
Browse files Browse the repository at this point in the history
  • Loading branch information
rtmigo committed Sep 23, 2021
1 parent a3714cb commit 5dfde63
Show file tree
Hide file tree
Showing 8 changed files with 29 additions and 20 deletions.
11 changes: 8 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
# [img2texture](https://github.com/rtmigo/img2texture_py#readme) (DRAFT)
[![Generic badge](https://img.shields.io/badge/status-draft-red.svg)](#)
[![PyPI version shields.io](https://img.shields.io/pypi/v/img2texture.svg)](https://pypi.python.org/pypi/img2texture/)
[![Generic badge](https://img.shields.io/badge/Python-3.7+-blue.svg)](#)
[![Generic badge](https://img.shields.io/badge/OS-Windows%20|%20macOS%20|%20Linux-blue.svg)](#)

# [img2texture](https://github.com/rtmigo/img2texture_py#readme)

Command line utility for converting images to seamless tiles.

Expand All @@ -19,7 +24,7 @@ We cannot use the original image as an endless space background: the seams are v

### Converted image x4

![Converted tiled](docs/2_orion_seamless.jpg2x2.jpg)
![Converted tiled](docs/2_orion_seamless_2x2.jpg)

The result of `img2texture`, in four copies side by side.

Expand All @@ -35,7 +40,7 @@ direction. It will feel endless and seamless.
# Install

```
$ pip3 install https://github.com/rtmigo/img2texture_py
$ pip3 install img2texture
```

# Run
Expand Down
File renamed without changes
6 changes: 3 additions & 3 deletions img2texture/_cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,15 +32,15 @@ def __init__(self):
parser.add_argument("source",
help="Path of source image file.")
parser.add_argument("target",
help="Path of target (tile) file.")
help="Path of the converted file.")
parser.add_argument("--tile",
action='store_true',
default=False,
help="Also make 2x2 tile.")
help="Create an additional file with four copies "
"of the converted image merged side by side")
parser.add_argument("--mode",
choices=[str(m.value) for m in Mode],
default=Mode.both)

parser.add_argument('--version',
action='store_true',
default=False,
Expand Down
6 changes: 6 additions & 0 deletions img2texture/_common.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
from PIL import Image

# preventing Image.DecompressionBombError: Image size (324000000 pixels)
# exceeds limit of 178956970 pixels, could be decompression bomb DOS attack.
# We just open a large file and are not afraid of it
Image.MAX_IMAGE_PIXELS = None
2 changes: 1 addition & 1 deletion img2texture/_constants.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
__version__ = "0.0.0"
__version__ = "0.0.1"

__copyright__ = "(c) 2021 Artyom Galkin <github.com/rtmigo>"
__license__ = "MIT"
7 changes: 1 addition & 6 deletions img2texture/_texturizing.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,7 @@
from pathlib import Path
from typing import Tuple

from PIL import Image

# preventing Image.DecompressionBombError: Image size (324000000 pixels)
# exceeds limit of 178956970 pixels, could be decompression bomb DOS attack.
# We just open a large file and are not afraid of it
Image.MAX_IMAGE_PIXELS = None
from ._common import Image # importing with tweaked options


# todo Find a way to add dithering noise to 8-bit grading
Expand Down
7 changes: 5 additions & 2 deletions img2texture/_tiling.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,13 @@

from pathlib import Path

from PIL import Image
from ._common import Image # importing with tweaked options


def tile(source: Path, target: Path, horizontal: int = 3, vertical: int = 3):
def tile(source: Path, target: Path,
horizontal: int = 3, vertical: int = 3) -> None:
"""Merges multiple copies of `source` image into the `target` image
side-by-side."""
image = Image.open(source)

w, h = image.size
Expand Down
10 changes: 5 additions & 5 deletions setup.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
from pathlib import Path

from setuptools import setup, find_packages
# 178956970
# 324000000


def load_module_dict(filename: str) -> dict:
import importlib.util as ilu
Expand Down Expand Up @@ -36,7 +35,7 @@ def load_module_dict(filename: str) -> dict:
long_description=readme,
long_description_content_type='text/markdown',

license="MIT",
license=constants['__license__'],

entry_points={
'console_scripts': [
Expand All @@ -46,13 +45,14 @@ def load_module_dict(filename: str) -> dict:
keywords="photo image texture tile seamless".split(),

classifiers=[
'License :: OSI Approved :: BSD License',
'License :: OSI Approved :: MIT License',
"Programming Language :: Python :: 3.7",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Environment :: Console",
"Typing :: Typed",
"Topic :: Software Development :: Build Tools",
"Topic :: Scientific/Engineering :: Image Processing",
"Topic :: Multimedia :: Graphics",
"Operating System :: POSIX",
"Operating System :: Microsoft :: Windows"
],
Expand Down

0 comments on commit 5dfde63

Please sign in to comment.