“Flagots” is a tool designed for quickly generating filler images with appealing colors. Contrary to public assumptions, its name is not derived from a derogatory term for homosexuals but from “fagot,” which means “a bundle of sticks used as fuel,” as well as the word “flag” in its original sense, meaning “a piece of fabric used as a symbol for a nation, state, organization, etc.” Essentially, I wanted to generate flags from arbitrary input images.
To achieve this, I wrote a Python script that calculates the strongest gray-value gradients in the vertical direction and then randomly selects a number of them as boundaries. Between these boundaries, rectangles are formed across the entire width of the image. These rectangles then receive the arithmetic mean of all the pixels they contain as the new color.
Sounds complicated? Let me illustrate with the well-known image “Bliss” by Charles O’Rear, which I used as a test image. If you are approximately my age or older, chances are high that you once had it as a wallpaper on your Windows XP computer. In this case, the image was segmented by the five strongest gradients.
Next, I attempted to use Flagots on national flags, but the results were underwhelming because most of them were already quite close to the output. Here’s an example with Israel, which turned out to be one of the better-looking results.
Instead, I applied Flagots to photos, computer graphics, and even random advertisements from my social media platforms. All yielded decent results, and even large amounts of text did not negatively affect the output image.
The next logical step was to perform the same calculations in the horizontal direction, resulting in output images with vertical stripes. Generally, the results appeared better when the input image already exhibited either horizontality or verticality. Consequently, I made the algorithm smart enough to discard one of the two images, typically the one with weaker gradients.
I also used AI-generated images as input images, particularly my baboons, as they were readily available and quite diverse. Here is one that has a calming effect on me.
The primary advantage of the output images is their small file size when using a compressed image format such as PNG or JPG. Additionally, they can be easily stretched to the required image size without appearing distorted or awkward. I often use them as banners where empty spaces are undesirable.
Leave a Reply