42

Tiler –a tool to create an image using all kinds of other smaller images

 5 years ago
source link: https://www.tuicool.com/articles/nim2qa3
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
neoserver,ios ssh client

muQrIvB.png!web

:construction_worker: Build images with images.

About

Tiler is a tool to create an image using all kinds of other smaller images (tiles). It is different from other mosaic tools since it can adapt to tiles with multiple shapes and sizes (i.e. not limited to squares).

An image can be built out of circles, lines, waves, cross stitches, legos, minecraft blocks, paper clips, letters, ... The possibilities are endless!

Installation

git clone https://github.com/nuno-faria/tiler.git
pip install -r requirements.txt

Usage

  • Make a folder with the tiles (and only the tiles) to build the image;
    • The script gen_tiles.py can help in this task; it builds tiles with multiple colors based on the source tile (note: its recommended for the source file to have an RGB color of (240,240,240)). It is used as python gen_tiles.py path/to/image and creates a folder with a 'gen_' prefix in the same path as the base image.
  • Run python tiler.py path/to/image path/to/tiles_folder/ .

Configuration

All configurations can be changed in the conf.py file.

gen_tiles.py

DEPTH
ROTATIONS

tiler.py

  • COLOR_DEPTH - number of divisions in each color channel (ex: COLOR_DEPTH = 4 -> 4 * 4 * 4 = 64 colors);
  • RESIZING_SCALES - scale to apply to each tile (ex: [1, 0.75, 0.5, 0.25]);
  • PIXEL_SHIFT - number of pixels shifted to create each box (ex: (5,5)); if None, shift will be the same as the tile dimension); q6j6fur.png!web
  • OVERLAP_TILES - if tiles can overlap;
  • RENDER - render image as its being built;
  • POOL_SIZE - multiprocessing pool size;
  • IMAGE_TO_TILE - image to tile (ignored if passed as the 1st arg);
  • TILES_FOLDER - folder with tiles (ignored if passed as the 2nd arg);
  • OUT - result image filename.

Examples

Circles

Various sizes

6juU7vu.png!web

Original cake image by pongsakornred from FLATICON .

Fixed

  • 10x10

rqaqEnu.png!web

MrAVzqE.png!web

- 25x25

MRnQFfR.png!web

- 50x50

QVRF7bi.png!web

Paper clips

AFJ3maQ.png!web

Cross stitch (times)

nmuIZbJ.png!web

AbyUnmY.png!web

Hearts

77rmUnR.png!web

Legos

EzeeIrJ.png!web

MJbeIjj.png!web

Minecraft blocks

u2umYzU.png!web

zaQRBvR.png!web

Stripes (lines)

UrmAveI.png!web

At

jiaUJra.png!web


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK