πŸ‘· Build images with images

Overview

title

πŸ‘· 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

  • Clone the repo: git clone https://github.com/nuno-faria/tiler.git;
  • Install Python 3;
  • Install pip (optional, to install the dependencies);
  • Install dependencies: 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 - number of divisions in each color channel (ex: DEPTH = 4 -> 4 * 4 * 4 = 64 colors);
  • ROTATIONS - list of rotations, in degrees, to apply over the original image (ex: [0, 90]).

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);
  • 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

Original cake image by pongsakornred from FLATICON.

Fixed

  • 10x10

- 25x25

- 50x50

Paper clips

Cross stitch (times)

Hearts

Legos

Minecraft blocks

Stripes (lines)

At

Comments
  • AttributeError: 'NoneType' object has no attribute 'shape'

    AttributeError: 'NoneType' object has no attribute 'shape'

    This is the error python tiler.py ./images/logo.png ./tiles/minecraft Loading tiles 99%|β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–Š| 150/151 [00:52<00:00, 2.96it/s]Traceback (most recent call last): File "tiler.py", line 223, in main() File "tiler.py", line 216, in main tiles = load_tiles(tiles_paths) File "tiler.py", line 85, in load_tiles tile = read_image(os.path.join(path, tile_name)) File "tiler.py", line 34, in read_image if img.shape[2] == 3: AttributeError: 'NoneType' object has no attribute 'shape' 99%|β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–Š| 150/151 [00:52<00:00, 2.85it/s]

    opened by KoderKumar 10
  • Config details for example output

    Config details for example output

    Hello there and thanks for this awesome repo.

    I am trying to manipulate the config parameters to get the awesome results in the readme ,but I can not make that happen.

    Can you provide details config for each example ?

    opened by AymanEG 8
  • TypeError: flip() missing 1 required positional argument: 'axis'

    TypeError: flip() missing 1 required positional argument: 'axis'

    WHEN I RUN :"python tiler.py images/gypsophila.png tiles/at/gen_at" , GET: File "tiler.py", line 188, in create_tiled_image place_tile(img,box) File "tiler.py", line 173, in place_tile p1 = np.flip(box['pos']) TypeError: flip() missing 1 required positional argument: 'axis'

    opened by Clowne1 4
  • Usage from the readme.md doesn't work

    Usage from the readme.md doesn't work

    Hello, I just install all requirements into virtualenv with py3 on the board and tried to run tiller.py (with raw config from master branch) on the png image from the sample images dir and nothing happen:

    $ mkdir result
    $ virtualenv -p python3 .env
    ...
    $ source .env/bin/activate
    (.env) $ pip install -r requirements.txt
    ...
    (.env) $ python3 tiler.py images/cake_lego.png ./result/
    Loading tiles
    0it [00:00, ?it/s]
    Gettting and processing boxes
    0it [00:00, ?it/s]
    Creating tiled image
    0it [00:00, ?it/s]
    (.env) $ ls ./result/
    (.env) $
    

    what's wrong with me?

    opened by objque 4
  • AttributeError: 'NoneType' object has no attribute 'shape'

    AttributeError: 'NoneType' object has no attribute 'shape'

    Traceback (most recent call last): File "tiler.py", line 223, in main() File "tiler.py", line 216, in main tiles = load_tiles(tiles_paths) File "tiler.py", line 85, in load_tiles tile = read_image(os.path.join(path, tile_name)) File "tiler.py", line 34, in read_image if img.shape[2] == 3:

    opened by 0x112a 3
  • AttributeError on tiler

    AttributeError on tiler

    Running on VirtualBox. LinuxMint w/ Python 3.7.4

    typing

    python tiler.py images/myimage.png tiles/lines/gen_line_h

    gives me the following:

    Loading tiles 100%|β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆ| 125/125 [00:00<00:00, 285.37it/s] Gettting and processing boxes 0%| | 0/5 [00:00<?, ?it/s]Traceback (most recent call last): File "tiler.py", line 223, in <module> main() File "tiler.py", line 217, in main boxes, original_res = get_processed_image_boxes(image_path, tiles) File "tiler.py", line 158, in get_processed_image_boxes most_similar_tiles = pool.starmap(most_similar_tile, zip(modes, [ts for x in range(len(modes))])) AttributeError: 'Pool' object has no attribute 'starmap' 0%| | 0/5 [00:33<?, ?it/s]

    opened by joeparrie 3
  • [Solved] AttributeError: 'NoneType' object has no attribute 'astype'

    [Solved] AttributeError: 'NoneType' object has no attribute 'astype'

    Hello

    I am following the usage instructions, but get some trouble.

    Firstly, I download the image "https://www.flaticon.com/free-icon/cake_1102780", then use the script:

    $ python tiler.py ~/Downloads/1102780.svg ~/Downloads
    Loading tiles
      0%|                                                                                                                                                                                                                                                     | 0/7 [00:00<?, ?it/s]
    Traceback (most recent call last):
      File "tiler.py", line 221, in <module>
        main()
      File "tiler.py", line 214, in main
        tiles = load_tiles(tiles_paths)
      File "tiler.py", line 83, in load_tiles
        tile = read_image(os.path.join(path, tile_name))
      File "tiler.py", line 34, in read_image
        img = color_quantization(img.astype('float'), COLOR_DEPTH)
    

    And my env:

    $ pip freeze
    numpy==1.17.2
    opencv-python==4.1.1.26
    tqdm==4.35.0
    

    Thanks @nuno-faria,I got it

    Here is the solution

    python tiler.py ~/Downloads/tmp/cake.png tiles/circles/gen_circle_100/
    

    I though the first parameter is my input image, and second parameter as output directory. But it is not, the second parameter is also input, as basic element.

    opened by cailu 3
  • Error running the tiler.py

    Error running the tiler.py

    Get the following error. Missing anything in my usage?

    `

    python tiler.py images/cake_lego.png ./tiles/clips/ Loading tiles 0%| | 0/2 [00:00<?, ?it/s]path 0%| | 0/2 [00:00<?, ?it/s] Traceback (most recent call last): File "tiler.py", line 225, in main() File "tiler.py", line 218, in main tiles = load_tiles(tiles_paths) File "tiler.py", line 87, in load_tiles tile = read_image(path + tile_name) File "tiler.py", line 38, in read_image img = color_quantization(img.astype('float'), COLOR_DEPTH) AttributeError: 'NoneType' object has no attribute 'astype' `

    opened by kamalhussain 3
  • IndexError: tuple index out of range

    IndexError: tuple index out of range

    Traceback (most recent call last): File "/home/kali/tiler/tiler.py", line 223, in main() File "/home/kali/tiler/tiler.py", line 217, in main boxes, original_res = get_processed_image_boxes(image_path, tiles) File "/home/kali/tiler/tiler.py", line 151, in get_processed_image_boxes img = read_image(image_path) File "/home/kali/tiler/tiler.py", line 34, in read_image if img.shape[2] == 3: IndexError: tuple index out of range

    opened by th3g3ntI3man 2
  • Requesting permission to use some of your Tiles

    Requesting permission to use some of your Tiles

    @nuno-faria I am creating my own tiler and while i have not copied any of your code I have used some of your tiles but I wanted to get permission to do this before I continue on. If you say no i will remove the tiles I have copied so far. Thanks

    opened by GypsyDangerous 2
  • It takes a long time

    It takes a long time

    I'm working with a 960 * 960 pixel image with circle_100 tile, it takes me about 20 mins. Is it because of the poor performance of my computer? Can I accelerate it with GPU? Looking forward your reply.

    opened by Dabao55 1
  • stuck at

    stuck at "Getting and processing boxes"

    when I run python tiler.py path/to/image path/to/tiles_folder/, stuck at "Getting and processing boxes".

    Loading tiles 100%|β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆ| 125/125 [00:03<00:00, 32.19it/s] Getting and processing boxes 0%|

    opened by fatbun 1
  • AttributeError: 'NoneType' object has no attribute 'split'

    AttributeError: 'NoneType' object has no attribute 'split'

    Traceback (most recent call last): File "tiler.py", line 223, in main() File "tiler.py", line 206, in main tiles_paths = conf.TILES_FOLDER.split(' ') AttributeError: 'NoneType' object has no attribute 'split'

    opened by lyhuangj 10
  • Continually receive IndexError: index 3 is out of bounds for axis 2 with size 3

    Continually receive IndexError: index 3 is out of bounds for axis 2 with size 3

    When trying to generate tiles I receive this with a standard image.

    Traceback (most recent call last): File "tiler.py", line 221, in main() File "tiler.py", line 216, in main img = create_tiled_image(boxes, original_res, render=conf.RENDER) File "tiler.py", line 186, in create_tiled_image place_tile(img, box) File "tiler.py", line 173, in place_tile mask = box['tile'][:, :, 3] != 0 IndexError: index 3 is out of bounds for axis 2 with size 3

    opened by alliedcvil 1
  • gen_tiles.py fails on certain images

    gen_tiles.py fails on certain images

    Certain images seem to work, but most fail with a very similar message to the example below

    All commands run from tiler's root directory (tiler/) Run command with .jpg version of image

    python3 gen_tiles.py images/test2/test2.jpg
    

    Output

      0%|                                                     | 0/5 [00:00<?, ?it/s]
    Traceback (most recent call last):
      File "gen_tiles.py", line 31, in <module>
        new_img = img * [b, g, r, 1]
    ValueError: operands could not be broadcast together with shapes (1360,1000,3) (4,) 
    

    Convert image to .png, run command again

    python3 gen_tiles.py images/test2/test2.png
    

    Output:

    Traceback (most recent call last):
      File "gen_tiles.py", line 23, in <module>
        img = img.astype('float')
    AttributeError: 'NoneType' object has no attribute 'astype'
    

    System information:

    • Python 3.7.2
    • pip 18.1 from /usr/local/lib/python3.7/site-packages/pip (python 3.7)
    • Mac OS X 10.14.5
    opened by patschreiber 1
Owner
null
A large-scale dataset of both raw MRI measurements and clinical MRI images

fastMRI is a collaborative research project from Facebook AI Research (FAIR) and NYU Langone Health to investigate the use of AI to make MRI scans faster. NYU Langone Health has released fully anonymized knee and brain MRI datasets that can be downloaded from the fastMRI dataset page. Publications associated with the fastMRI project can be found at the end of this README.

Facebook Research 907 Jan 4, 2023
A simple programming language for manipulating images.

f-stop A simple programming language for manipulating images. Examples OPEN "image.png" AS image RESIZE image (300, 300) SAVE image "out.jpg" CLOSE im

F-Stop 6 Oct 27, 2022
A simple Streamlit Component to compare images in Streamlit apps. It integrates Knightlab's JuxtaposeJS

streamlit-image-juxtapose A simple Streamlit Component to compare images in Streamlit apps using Knightlab's JuxtaposeJS. The images are saved to the

Robin 30 Dec 31, 2022
Fixes 500+ mislabeled MURA images

In this repository, new csv files are provided that fixes 500+ mislabeled MURA x-rays for all categories. The mislabeled x-rays mainly had hardware in them. This project only fixes the false negatives for now.

Pieter Zeilstra 4 May 18, 2022
Simple Python / ImageMagick script to package images into WAD3s for use as GoldSrc textures.

WADs Out For [The] Ladies Simple Python / ImageMagick script to package images into WAD3s for use as GoldSrc textures. Development mostly focused on L

null 5 Apr 9, 2022
HtmlWebShot - A python3 package which Can Create Images From url, Html-CSS, Svg and from any readable file and texts with many setup features.

A python3 package which Can Create Images From url, Html-CSS, Svg and from any readable file and texts with many setup features

Danish 24 Dec 14, 2022
pix2tex: Using a ViT to convert images of equations into LaTeX code.

The goal of this project is to create a learning based system that takes an image of a math formula and returns corresponding LaTeX code.

Lukas Blecher 2.6k Dec 30, 2022
A scalable implementation of WobblyStitcher for 3D microscopy images

WobblyStitcher Introduction A scalable implementation of WobblyStitcher Dependencies $ python -m pip install numpy scikit-image Visualization ImageJ

CSE Lab, ETH Zurich 7 Jul 25, 2022
Glyphtracer is an app for converting images of letters to a font

Glyphtracer takes an image that contains pictures of several letters. It recognizes all them and lets the user tag each letter to a Unicode code point. It then converts the images to vector form and writes them to a FontForge's data format. The font can then be finalized with FontForge.

Jussi Pakkanen 38 Dec 24, 2022
Django helper application to easily and non-destructively crop arbitrarily large images in admin and frontend.

django-image-cropping django-image-cropping is an app for cropping uploaded images via Django's admin backend using Jcrop. Screenshot: django-image-cr

Jonas und der Wolf GmbH 546 Jan 3, 2023
A drop-in replacement for django's ImageField that provides a flexible, intuitive and easily-extensible interface for quickly creating new images from the one assigned to the field.

django-versatileimagefield A drop-in replacement for django's ImageField that provides a flexible, intuitive and easily-extensible interface for creat

Jonathan Ellenberger 490 Dec 13, 2022
Fast batch image resizer and rotator for JPEG and PNG images.

imgp is a command line image resizer and rotator for JPEG and PNG images.

Terminator X 921 Dec 25, 2022
Python Image Morpher (PIM) is a program that can take two images and blend them to whatever extent or precision that you like

Python Image Morpher (PIM) is a program that can take two images and blend them to whatever extent or precision that you like! It is designed to emulate some of Python's OpenCV image processing from scratch without reference.

David Dowd 108 Dec 19, 2022
A python program to generate ANSI art from images and videos

ANSI Art Generator A python program that creates ASCII art (with true color support if enabled) from images and videos Dependencies The program runs u

Pratyush Kumar 12 Nov 8, 2022
A utility for quickly cropping large collections of images.

Crop Tool A utility for quickly cropping large collections of images. Inspired by Derrick Schultz's dataset-tools. Setup It's suggested that you use A

dusk (they/them) 6 Nov 14, 2021
Optimize/Compress images using python

Image Optimization Using Python steps to run the script run the command to install the required libraries pip install -r requirements.txt create a dir

Shekhar Gupta 1 Oct 15, 2021
Computer art based on joining transparent images

Computer Art There is no must in art because art is free. Introduction The following tutorial exaplains how to generate computer art based on a series

Computer Art 12 Jul 30, 2022
Command line utility for converting images to seamless tiles

img2texture Command line utility for converting images to seamless tiles. The resulting tiles can be used as textures in games, compositing and 3D mod

ArtΡ‘m IG 24 Dec 26, 2022
Kimimaro: Skeletonize Densely Labeled Images

Kimimaro: Skeletonize Densely Labeled Images # Produce SWC files from volumetric images. kimimaro forge labels.npy --progress # writes to ./kimimaro_o

null 92 Dec 17, 2022