Skip to main content

img2texture

Command line utility for converting images to seamless tiles. It overlays images with an alpha gradient.

The resulting tiles can be used as textures in games, compositing and 3D modeling applications, etc.

⚠️ If the images below are not displayed, check out the original of this document on GitHub.

Original image x4

Source tiled

Orion galaxy by NASA/ESA, in four copies side by side.

We cannot use the original image as an endless space background: the seams are visible.

Converted image x4

Converted tiled

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

The image is slightly reduced in size and the edges are modified with alpha-blending.

The converted image can be tiled and panned in any direction. It will feel endless and seamless.

Install

The easiest way is to download and extract a binary executable:

Or install as a Python package:

pip3 install img2texture

Run

Create new seamless.jpg from source.jpg.

img2texture /path/to/source.jpg /path/to/seamless.jpg 

--overlap

The --overlap option determines how much of the image will be used to hide the seams.

For example, the following command uses 25% of the width and 25% of the height of the original image:

img2texture source.jpg seamless.jpg --overlap 0.25 

Increasing the value makes the seam less visible. However, the image becomes smaller.

Sample images

⚠️ If the images below are not displayed, check out the original of this document on GitHub.

--overlap 0.05

5% of the width and 5% of the height are used to mask the seam.

--overlap 0.05

--overlap 0.4

40% of the width and 40% of the height are used to mask the seam.

--overlap 40

--tile

The --tile option will create a 2x2 tiled version in addition to the converted image.

The following command will create seamless.jpg and seamless_2x2.jpg.

img2texture source.jpg seamless.jpg --tile 

All the samples on this page were created with --tile.

Use programmatically

If you don't need CLI but need to create seamless image in your own program:

from PIL import Image
from img2texture import image_to_seamless

# load PIL image
src_image = Image.open("/path/to/source.png")

# convert to seamless PIL image
result_image = image_to_seamless(src_image, overlap=0.1)

# save
result_image.save("/path/to/result.png")

overlap=0.1 means 10%, and overlap=(0.1, 0.2) means 10% horizontal, 20% vertical.

License

Copyright © 2021 Artёm iG. Released under the MIT License.

Metadata

Release files for img2texture 1.1.2.post2

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

Source distribution (sdist)

Source distribution for img2texture 1.1.2.post2
File Size Uploaded
img2texture-1.1.2.post2.tar.gz 8.8 kB Details

Built distribution (wheel)

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

Total release size: 17.9 kB

Release files / img2texture-1.1.2.post2.tar.gz

Download URL img2texture-1.1.2.post2.tar.gz
Size 8.8 kB
Tags Source
SHA-256 checksum
How to use checksums
eb825168bf6a8fd80f068e9fdd49551cb1b86d9244c085cee34c72abce3c40aa
BLAKE2b-256 checksum
How to use checksums
4eaef7345a1ccc7381d29e14e81693d6324c0c1d62ec76d1679683eadba54438
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/4.0.2 CPython/3.11.6

Release files / img2texture-1.1.2.post2-py3-none-any.whl

Download URL img2texture-1.1.2.post2-py3-none-any.whl
Size 9.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
aa652e5b6870f1b1eeda4dedecf4b593898fd7375218d3eb1e4ced8aa5226cca
BLAKE2b-256 checksum
How to use checksums
7a14e33371a75c671aaae8b54963ea106cb12cef6f7a9c9005db6ec8acae8842
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/4.0.2 CPython/3.11.6
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