Poster is a command line tool written in Go that, given a folder containing images, combines them in a grid and it creates a new image that contains a thumb of each of them. Here an image that i’ve obtained running
poster in an a folder with 14 images.
Default options and example
poster -h you have a list of the default options
To customize them, do as follow, overriding the default options with yours
poster -dest_dir=/home/username/dest -source_dir=/home/username/source -log_file=/home/username/my.log
How does it works
- The program reads list the images located in the folder and creates a map of them.
- Having the total number of the images and the desired dimension of the thumb, it calculates the dimension of the destination grid, see this file for the details about this part.
- Each file can now be assigned to a position in the grid, it iterates through the images, it scales them to the given dimension if necessary(i’ve used this package for the resize, check it out, it provides a lot of functionalities to work with images), and put each file in the destination image.