How to Create a Cool Photo Mosaic on Linux With Polyfoto

Photo mosaics make thoughtful gifts, and can brighten up plain walls with beautiful images of vacations, childhood memories, or even pop culture. It’s easy to make a photo mosaic from the Linux command line. Here’s how.

What Is a Photo Mosaic, and Why Would You Want One?

A photo mosaic is a picture that is made up of other, much smaller pictures, similar to the way that pixels make up an image on a TV or computer screen, individual, colored dots make up images in newspapers, or small stones make up the picture in an actual mosaic.

Every picture you take will have a dominant color, and photo mosaic generators will use that dominant color to contribute to a much larger image. The more images you have available, the finer the detail in the completed photo mosaic will be.

A photo on your wall or as the wallpaper on your desktop is great, but being able to focus in on a small area and see the individual images which make it up, is even better.

Photo mosaics work well if the images which make it up are thematically linked to the main image. A photo mosaic of your recent foreign holiday, for example, is fantastic if it’s made up of images from that holiday.

Polyfoto Lets You Create Fantastic Photo Mosaics in Your Linux Terminal

If you have a folder full of photos you want to use for your photo mosaic, along with the image you want to use them to make up, creating a photo mosaic with Polyfoto is as simple as running a single command in your terminal—although you can add parameters to customize your output image however you want.

You will be cloning the Polyfoto GitHub repository, so if you don’t have Git on your system, install it now:

On Debian-based systems:

sudo apt install git

For Red Hat-related distros:

dnf install git

On Arch Linux and its derivatives:

sudo pacman -S git

Now clone the Polyfoto repository:

git clone https:

Move into the Polyfoto directory:

cd polyfoto

…and install it with Python:

python3 install

Once you’ve installed Polyfoto, you can run it with:

python3 -f input.png -d sources -o output.png -n 16

…where input.png is the image you want your photo mosaic to resemble, sources is the directory that contains the photos which will make up the mosaic, and output.png is the filename of the image which will be created. The -n argument is the number of image rows that will make up the final image.

As an example, we’ve put 100 images in the “hols” folder, and we want to use the image “my_head.jpg” as the base image, and we’re satisfied with the other defaults:

python3 -f ~/hols/my_head.jpg -d hols -o output.png -n 16

Note that the command must be run from within the Polyfoto directory, so make sure to either move your photos folder to within that directory or use absolute paths within the command.

The process isn’t quick, and the photo below took around a minute to produce on a 16GB i5 machine with a GTX 1050 card. Polyfoto doesn’t specify how much memory you need, but it’s always worth checking how much RAM you have.

It doesn’t look like anything much. Increasing the number of rows to 128 yielded better results, although creation time increased to almost 25 minutes. The reasons for this are unclear, as the CPU and RAM remained relatively untaxed.

Needless to say, creating a photo mosaic works better with simple images than with complex ones with a lot going on. More complex mosaics require more individual images to act as “pixels” to make them clear. Choose carefully, and you’ll get good results.

Going beyond the basics, Polyfoto offers a number of optional arguments, allowing you to, among other things, set the proportional center of construction, choose a rescaling factor, and specify a pixel height of thumbnails. For the full documentation, visit the project’s GitHub page.

Photo Mosaics Make Great Gifts for Your Relatives and Friends

It’s always hard to choose a gift to give to your nearest and dearest, but you can’t go far wrong with a present based on shared memories and experiences.

While photo mosaics may be great to give your parents, siblings, children, or close friends, for people who you’re not especially close to, or who you know won’t appreciate such a personal item, use a gift guide or recommendation engine instead.

Source link

Leave a Reply

Your email address will not be published. Required fields are marked *