🤖🖌️ Automatically generate new textures similar to a source photograph.
Project description
neural-texturize
Automatically generate new textures similar to your source image. Useful if you want to make variations on a theme or expand the size of an existing texture.
1. Examples & Usage
The main script takes a source image as a texture, and generates a new output that captures the style of the original. Here are some examples:
texturize samples/grass.webp --size=1440x960 --output=result.png
texturize samples/gravel.png --iterations=200 --precision=1e-5
texturize samples/sand.tiff --output=tmp/{source}-{octave}.webp
texturize samples/brick.jpg --device=cpu
For details about the command-line options, see the tool itself:
texturize --help
Here are the command-line options currently available:
Usage: texturize SOURCE... [--size=WxH] [--output=FILE] [--seed=SEED] [--device=DEVICE] [--octaves=O] [--precision=P] [--iterations=I] texturize --help Options: SOURCE Path to source image to use as texture. -s WxH, --size=WxH Output resolution as WIDTHxHEIGHT. [default: 640x480] --seed=SEED Configure the random number generation. --device=DEVICE Hardware to use, either "cpu" or "cuda". --octaves=O Number of octaves to process. [default: 5] --precision=P Set the quality for the optimization. [default: 1e-4] --iterations=I Maximum number of iterations each octave. [default: 99] -o FILE, --output=FILE Filename for saving the result. [default: {source}_gen.png] -h --help Show this message.
2. Installation
This repository uses submodules, so you’ll need to clone it recursively to ensure dependencies are available:
git clone --recursive https://github.com/photogeniq/neural-texturize.git
Then, you can create a new virtual environment called myenv by installing Miniconda and calling the following commands, depending whether you want to run on CPU or GPU (via CUDA):
cd neural-texturize
# a) Use this if you have an *Nvidia GPU only*.
conda env create -n myenv -f tasks/setup-cuda.yml
# b) Fallback if you just want to run on CPU.
conda env create -n myenv -f tasks/setup-cpu.yml
Once the virtual environment is created, you can activate it and finish the setup of neural-texturize with these commands:
conda activate myenv
poetry install
Finally, you can check if everything worked by calling the script:
texturize
You can use conda env remove -n myenv to delete the virtual environment once you are done.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Hashes for texturize-0.5.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7094a4a500982345420e6c88322edcbe74dd15ace1a8e7749db68183c5f29ca1 |
|
MD5 | de6368ab4b3086f08658766d0c0f162a |
|
BLAKE2b-256 | fd4476ecfde432a633972e42039fae286934bccfc3de3150c323c2f5363a226b |