nuno-faria / tiler

👷 Build images with images
MIT License
5.89k stars 423 forks source link

Not able to create mosaic using human face image (tile image) #46

Open arnabdasdigerati opened 10 months ago

arnabdasdigerati commented 10 months ago

I am not able to create mosaic using human faces. I am using human faces as tiles. it is generating something else not as the main cover image. can you please guide me regarding this ?

nuno-faria commented 10 months ago

Hello, could you show me the commands that you are using to generate the image?

arnabdasdigerati commented 10 months ago

yes, below mentioned command I have used to generate mosaic.

command: python tiler.py images/ssp-bnr-img.jpg tiles/tile_image/

I am rendering main image - ssp-bnr-img.jpg from image folder and tile images from tile/tile_image folder. tile_image folder is having 128x128 dimension human face images.

I am using below configurations- COLOR_DEPTH = 32 RESIZING_SCALES = [0.5, 0.4, 0.3, 0.2, 0.1] PIXEL_SHIFT = (10, 10) OVERLAP_TILES = False POOL_SIZE = 12 OUT = 'out.png' IMAGE_TO_TILE = None TILES_FOLDER = None

Please guide me to fix the issue. Thank you.

nuno-faria commented 10 months ago

For your particular use case, I would recommend using a grid pattern, i.e., setting the pixel shift to none and using a single scale. Example:

RESIZING_SCALES = [0.1]
PIXEL_SHIFT = None

If the tiles are too small for the image, you can try increasing the RESIZING_SCALES. If on the other hand the tiles are too big in the final image, you can try decreasing the RESIZING_SCALES to something like 0.05.

Let me know if this works for you.

arnabdasdigerati commented 10 months ago

out

it is generating the mosaic. But when zoom out the output image file, small file images are also getting pixelated. tile images are not clear. Color of whole output image also it got damaged.

Above I have attached the output image file for your reference. Can you please guide to fix this ?

nuno-faria commented 10 months ago

To be able to see each tile clearly while keeping each tile small, we have to scale up the image to tile. I just added a new parameter called IMAGE_SCALE to achieve that. For your case, you can start with something such as this:

IMAGE_SCALE = 5
RESIZING_SCALES = [1]
PIXEL_SHIFT = None

If you find that each tile is too big, you can increase the IMAGE_SCALE. Let me know if this works.